(Adds details, updates prices to close)
* TSX ends down 12.82 points, or 0.08 percent, at 16,209.13
* Eight of the TSX's 10 main groups fall
* Index rises 6 pct in 2017, boosted by financials, miners
By Alastair Sharp
TORONTO, Dec 29 (Reuters) - Canada's main stock index slipped on the last trading day of 2017 as some energy and mining stocks pulled back, but the index notched a 6 percent gain for the year, underperforming the three main U.S. indexes as its large energy component dragged.
* The Toronto Stock Exchange's S&P/TSX composite index ended down 12.82 points, or 0.08 percent, at 16,209.13 on Friday. Eight of the 10 main sectors were in negative territory, while advancers outnumbered decliners by 1.3-to-1 overall.
* The index's slip was offset by gains for banks and gold miners, while base metal miners and energy names weighed.
* The index's 6 percent rise in 2017 compared with gains of between 19 and 28 percent for Wall Street's S&P 500, Dow Jones Industrial Average and Nasdaq Composite.
* The energy group lost almost 13 percent this year, even as U.S. crude oil prices rose 12 percent, while materials were up 6 percent and financials added 9 percent. The three groups account for almost two-thirds of the index's weight.
* Marijuana producer Aphria Inc gained 3.9 percent on the day to C$18.70. Aphria and other cannabis stocks have made sharp gains this year as Canada heads toward legalization of recreational marijuana use in 2018.
* The materials group, which includes precious and base metals miners and fertilizer companies, lost 0.2 percent.
* B2Gold Corp advanced 2.7 percent to C$3.88 and Detour Gold Corp rose 2.3 percent to C$14.78 as gold prices hit their highest level in 2-1/2 months.
* Hudbay Minerals Inc fell 1.9 percent to C$11.13, First Quantum Minerals Ltd was down 1.7 percent to C$17.61, and Teck Resources lost 1.7 percent to C$32.87 .
* The energy group retreated 0.2 percent, while financials were flat overall and bank gains were offset by insurer losses. (Reporting by Alastair Sharp; Editing by Meredith Mazzilli and Leslie Adler)