Switzerland stunned markets Thursday by allowing its currency to trade freely against the euro.

The Swiss National Bank said it was removing a cap of 1.2 Swiss francs to the euro, introduced during the eurozone crisis in 2011 when a flood of cash sought refuge in the traditional safe haven.

Switzerland was worried that a rapid appreciation in its currency would slam exporters and cause deflation in its economy.

"This exceptional and temporary measure protected the Swiss economy from serious harm. While the Swiss franc is still high, the overvaluation has decreased as a whole since the introduction of the minimum exchange rate," the central bank said in a statement.

The announcement sent the franc soaring against all major currencies. By midday Thursday, the franc was approaching parity with the euro, up 14%. It gained similarly against the dollar to stand at $1.14.

The surprise move caused gyrations in stock markets across Europe, although most rebounded by afternoon trading.

The one striking exception was Switzerland's market. It tanked 10%, and shares of many leading Swiss companies such as Credit Suisse, UBS, Novartis and Nestle were also down around 10%.

Why did Switzerland act now? Some analysts said the Swiss central bank may have felt compelled to drop the currency peg in anticipation of a big move next week by the European Central Bank.

The ECB is widely expected to announce stimulus measures on January 22. That will flood the market with euros, making it difficult for the Swiss to defend a fixed exchange rate with the currency of its major trading partner.

However, in an effort to ensure investors don't get too excited about swapping euros or dollars for francs, the central bank also slashed interest rates to -0.75%, down from -0.25%.

"It's like a tax on people holding money in Swiss francs," said Simon Smith, the chief economist at FxPro in London.

Related: One U.S. dollar could soon equal one euro

The Swiss National Bank hasn't given up entirely in its attempt to avoid an overvalued currency. It said it would continue to intervene in foreign exchange markets.

Kit Juckes, strategist at Societe Generale, said it appeared the central bank acted because it saw no end in sight to upward pressure on the franc from ECB stimulus, fears about Greece reviving the eurozone crisis and other geopolitical tensions.

"That's not a great vote of confidence in the prospects for either calmer markets in the months ahead, or for the euro's future value. So the [bank] has decided to jump to 'Plan B' rather than persist with the previous one," he wrote in a note.

Related: Why Europe will outrun Wall Street in 2015. No, really.

It may, though, pay more attention to the franc's value against a broader basket of currencies, rather than focusing on the euro.

While roughly 45% of Swiss exports go to eurozone countries, and a sharp jump in the currency against the euro will hurt, policymakers may be more concerned about protecting the market for Swiss luxury goods in China, Juckes said.