Iceland's prime minister Sigmundur Gunnlaugsson resigned on Tuesday, just two days after the Panama Papers revealed that he had about $4 million of undisclosed assets tied up in an offshore tax haven.

Sigurdur Ingi Johansson, the Minister of Fisheries and Agriculture and Iceland's deputy prime minister, told reporters that he will assume Gunlaugsson's position as prime minister and leader of the Progressive Party.

Calls for Gunnlaugsson's resignation began hours after the news broke on Sunday, revealing that he, together with his wife and business partner Anna Sigurlaug Palsdottir, set up a shell company called Wintris Inc. with law firm Mossack Fonseca in 2007 in the British Virgin Islands. The company was used to invest millions of dollars of inherited money, according to a document signed by Palsdottir last year, the BBC reported.

The chairman of Gunnlaugsson's Progressive Party, at least one senior government adviser, prominent former bankers and handful of tycoons from Iceland were also implicated in the documents, which were sent to German newspaper Süddeutsche Zeitung by an anonymous source over a year ago and a first batch of which was released on Sunday. The leak contained 11.5 million documents and is being widely touted as the biggest data dump in history.

Earlier on Tuesday, Gunnlaugsson asked the president to dissolve parliament, and took to Facebook to express his preparedness in the event of an early election. "I told the leader of the Independence Party that if the party's parliamentarians think they cannot support the government in completing joint tasks, I would dissolve parliament and call a general election," he wrote.

Iceland is still recovering from its devastating financial crisis, during which three of the country's top banks went under. The crisis was at its lowest between 2008 and 2011. Gunnlaugsson took office in 2008, vowing to defend the country from foreign creditors whom he described as "vultures."

When he entered parliament, he did not, however, disclose the fact that he had $4 million in bonds tied up in an offshore shell company. He has also denied having an offshore account in the past. "Myself? No," he reportedly said when questioned recently about his links to Mossack Fonseca. "Well, the Icelandic companies I have worked with had companies with offshore companies."

"I have not considered quitting because of this matter nor am I going to quit because of this matter," Gunnlaugsson said on Monday, as quoted by the Associated Press. "The government has had good results. Progress has been strong and it is important that the government can finish its work."

Thousands of people gathered in the square outside Reykjavik on Monday to protest. Police estimated there were about 10,000 people in attendance, a relatively enormous number in a nation of about 320,000. "What would be the most natural and the right thing to do is that (he) resign as prime minister," Birgitta Jonsdottir, the head of the Pirate Party, one of Iceland's biggest opposition parties, told Reuters on Monday. "There is a great and strong demand for that in society and he has totally lost all his trust and believability."

The prime minister abruptly walked out of an interview last month when a journalist from a Swedish news outlet questioned him about Wintris Inc.