Given all of the uncertainty the economy faced during 2012, it's no wonder why gold remained a top draw for investors. The safe haven status and inflation fighting abilities of gold helped propel funds like the ETFS Physical Swiss Gold Shares (ARCA:SGOL) into more portfolios.

However, while investors swooned for physical gold, the firms that dig the precious metal out of the ground weren't so lucky. Many gold miners saw difficulties this past year, which resulted in dwindling share prices. While 2013 promises to be better, it's important to look back at where we've been.

Here's Investopedia's look back at the gold mining sector over the past 12 months.

Guide To Oil And Gas Plays: We've got your comprehensive guide to oil and gas shales in North America.

A Losing Year
For investors in the gold mining sector, 2012 was a real stinker. The Market Vectors Gold Miners ETF (ARCA:GDX) - which focuses on the large-cap producers in the sector - sank roughly 16% this year. Meanwhile, its junior mining twin - the Market Vectors Junior Gold Miner ETF (ARCA:GDXJ) fell 22.2% in 2012. These losses have also underperformed the physical metal itself throughout the year, and 2012 caps off a five-year streak of underperforming bullion. Those returns certainly don't make for happy holidays.

All in all, it's been a volatile year for the miners.

First, while they may act like a leveraged play on rising gold prices, the fiscal cliff has many gold mining stocks following the same path as the rest of the equities market -down. Investors have dumped equities for fear of higher taxes in 2013 on dividends and capital gains. Part of that dumping has been the mining stocks - many of which now pay juicy gold price-tied dividends.

The tax rate on long-term capital gains for equities is expected to jump from 15% to the ordinary income rate of 23.8%. At the same time, currently dividend taxes are set at 15% but could rise to a maximum of 43.4%. On the flipside, gold bullion and funs like the SPDR Gold Shares (ARCA:GLD) are taxed as collectibles at just 28%. From a tax perspective, bullion now has the upper hand.

Secondly, the miners' operating environment has become a little sticky. Latin American miners like Compania de Minas Buenaventura (NYSE:BVN) have faced higher operating costs across the broad. Both energy and equipment prices continue to rise as supplies remain tight. One of the benefits to mining firms was the relatively low fixed costs. A 1% increase in the price of gold will often equal a greater than 1% increase in operating income. However, over the last year or so, those fixed costs have risen, eroding some of the firm's profits.

SEE: A Beginner's Guide To Mining Stocks

Aside from rising fixed costs at mines, labor issues continue to plague the sector. Wages have gone up, but perhaps more important to the miners' positions has been the outbreak of some serious violent strikes. South Africa remains a hot bed of violent mine activity, and investors remain shaken even as mines are reopened. AngloGold Ashanti (NYSE:AU) recently reopened its Mponeng mine following union negotiations after being closed for a week. Yet, the stock price hasn't recovered on the news.

Analysts also peg some of the woes of the sector on wasted capital that was spent on acquisitions made at the peak of gold prices. These poorly timed buys have hurt profitability and the miners' potential.

A Look Ahead
So will 2013 bring gains to the gold miners? Most analysts say yes, the various quantitative easing and stimulus programs continue to persist in the developed world, while fevered buying by emerging market central banks hasn't ended. Overall, that will make a pretty good environment for higher gold prices. At the same time, many analysts estimate that share prices for the gold miners can't really get any lower. That gives the sector potential to outperform in the New Year as bullion prices continue to rise.

SEE: 8 Reasons To Own Gold

The Bottom Line
For the gold miners like Barrick (NYSE:ABX), 2012 could be a year to forget. Several factors have contributed to underperformance relative to gold prices. For investors, 2013 promises to be a better year in the sector.

At the time of writing, Aaron Levitt did not own any shares in any company mentioned in this article.