* TSX rises 5.88 points, or 0.05 percent, to 12,046.28 * Nine of 10 subgroups decline * RIM shares gain nearly 2 percent By John Tilak TORONTO, Nov 20 (Reuters) - Canada's main stock index ended slightly higher on Tuesday, as bank shares rose on a safety bid after U.S. Federal Reserve Chairman Ben Bernanke said the Fed does not have the tools to cushion the U.S. economy if politicians fail to avoid punitive spending cuts and the expiration of tax cuts. The Toronto index was weighed down by shares of heavyweight mining and energy companies, and the financial sector was one of a few main sectors to notch a gain, after Bernanke said the U.S. central bank could not offset the damage that would result from falling off the "fiscal cliff." "The market is being very tentative. Investors aren't willing to commit to anything," said Michael Sprung, president of Sprung Investment Management. The Toronto Stock Exchange's S&P/TSX composite index ended up 5.88 points, or 0.05 percent, at 12,046.28. Banks were almost solely responsible for the positive finish, after the index traded lower for most of the session. "It's a flight to safety. People are looking for safe havens in the market to park. The dividend yields in the banks are quite attractive," Sprung said. Investors also fretted about Europe after Moody's stripped France of its triple-A sovereign credit rating, citing an uncertain fiscal outlook and deteriorating economy. "It reinforces the point that Europe has not solved its problems. The bad news continues," said Gavin Graham, president of Graham Investment Strategy. "The growth-oriented sectors - whether it is energy, resources, industrials - are all getting thumped because people are worried about the outlook for global growth." The index's materials sector, which includes mining stocks, was down 0.4 percent. Silver Wheaton Corp lost 1.3 percent to C$36.28 and Agnico Eagle Mines Ltd fell 1.5 percent to C$54.36. Industrial stocks were off 0.6 percent and energy stocks edged lower, tracking a dip in oil prices. Cenovus Energy Inc fell 1.1 percent to C$32.62, and Talisman Energy Inc fell 2.4 percent to C$11.03. Brent crude fell nearly 2 percent on signs that a ceasefire was imminent after a week of violence between Israel and Palestinians in Gaza. Royal Bank of Canada ended up 1.54 percent at C$57.40, leading the surge in financials. Toronto Dominion Bank gained 0.7 percent to C$80.16, and the Bank of Nova Scotia was up 0.7 percent at C$53.76. BlackBerry maker Research In Motion Ltd also got a boost, rising 1.2 percent to C$9.70 after a Jefferies analyst upgraded the company ahead of the launch of its BlackBerry 10 devices at the end of January.