The Toronto Stock Exchange's S&P/TSX composite index ended up 20.36 points, or 0.1%, at 21,126.36. For the month, it was also up 0.1%.

The small gain outperformed a fall in global stocks after the West ramped up sanctions against Moscow over its invasion of Ukraine. The Russian rouble tanked to record lows and safe-haven assets got a boost after the new measures limited Moscow's ability to deploy its $630 billion in foreign reserves and cut off some of its banks from the SWIFT global payments system. [MKTS/GLOB]

The energy sector on the TSX climbed 2.6% as U.S. crude oil futures settled 4.5% higher on the potential for severe disruption to Russia's oil exports, while gold climbed 1.1% to $1,909.20 per ounce.

The materials group, which includes precious and base metals miners and fertilizer companies, ended 0.6% higher, helped by a 7.6% gain for uranium producer Cameco Corp.

Together, the materials and energy groups account for nearly 30% of the Toronto market.

Sectors that fell included consumer staples, which ended 1.8% lower, and financials, which lost 1.1%, including a decline of 2.3% for Toronto-Dominion Bank Group.

Canada's second largest lender said it would buy First Horizon Corp in an all-cash deal for $13.4 billion to expand its footprint in the United States.

"The banks so far have come with pretty good numbers and the acquisition by TD is a good sign that they're feeling pretty good about their balance sheets," said Gregory Taylor, portfolio manager at Purpose Investments.

Last week, major lenders including Canadian Imperial Bank of Commerce, National Bank of Canada and Royal Bank of Canada reported earnings above Wall Street expectations.

(Reporting by Fergal Smith; additional reporting by Amal S in Bengaluru; editing by Richard Pullin)

By Fergal Smith