REYKJAVIK, Iceland — Iceland’s prime minister announced on Sunday that he would resign, as the insurgent, anti-establishment Pirate Party capitalized on a wave of anger over corruption to come in second place in the country’s general election.
The prime minister, Sigurdur Ingi Johannsson, announced his departure on national television, after his center-right Progressive Party saw its share of seats in the 63-seat Parliament collapse to eight from 19 in the previous election, in 2013.
Mr. Johannsson’s predecessor as prime minister, Sigmundur David Gunnlaugsson, was forced from office in April amid accusations of conflicts of interest after revelations in leaked documents, known as the Panama Papers, of the hidden wealth of the country’s elite.
The conservative Independence Party, which has been in a governing coalition with the Progressives, came in first with 21 seats, up from 19 in the last election.
But the big winner of the night was the four-year-old Pirate Party, which took 10 seats, more than tripling its showing of three seats in the last general election. The Left-Green Party also won 10 seats. The parties tied for second place in parliamentary seats.
The left-leaning parties — the Left-Greens, the Pirates and two allies — won 27 seats, just short of the 32 required to command a majority in Iceland’s Parliament, the world’s oldest.
The liberal Regeneration Party, which is expected to play the role of kingmaker in the horse-trading following the election, has ruled out joining a coalition with the current governing establishment parties. This could mean that left-leaning parties could potentially form a ruling coalition.
While the conservative Independence Party made gains, “it is not a return to the status quo,” said Andres Jonsson, a political consultant. To form a government, the party will have to extend its hand to smaller, more rebellious groups, he said.
“The traditional party system has been disrupted,” Mr. Jonsson said. “We are not seeing big movements of people who feel that they are able to relate with the messages of the big coalition parties. Changes are going to come from the outside, not from inside the old parties.”
The election highlighted the fragmentation of the political landscape. A dozen parties fought for power over an electorate of about 260,000, barely enough to fill three American football stadiums.
Birgitta Jonsdottir, the anarchist leader of the Pirate Party, said she was satisfied with the result. “Whatever happens, we have created a wave of change in the Icelandic society,” she told a cheering crowd here early Sunday morning.
About 40 percent of Pirate supporters are under the age of 30. They had pinned their hopes on a party that has promised to install a more inclusive and transparent government.
The Pirates have pledged to enhance direct democracy by passing the world’s first “crowd-sourced constitution,” drafted by Icelandic civilians rather than politicians. Parliament blocked the document in 2013.
The party also wants to redistribute wealth and increase the government’s anticorruption powers. (The country is already the 13th least corrupt country in the world, according to Transparency International, a watchdog group, ahead of the United States.)
“We want to see trickle-down ethics rather than make-believe trickle-down economics,” Ms. Jonsdottir, 49, who is also a former WikiLeaks activist, said in an interview on the eve of the election.
Strong anti-establishment feeling has swept through Iceland since the financial crisis, and has been aggravated by the Panama Papers scandal in April, which sent thousands of protesters into the streets. The Pirate Party has benefited from a wave of dissent that has swept through Europe and the United States, upending traditional politics and fracturing mainstream parties.
In 2008, Iceland’s economy collapsed after its banking sector, fresh from deregulation, grew exponentially. In the years before that, Icelanders binged on credit, some becoming billionaires overnight. By 2006, the average Icelander was 300 percent wealthier than three years earlier. Cronyism became rampant.
When the crisis hit, Icelanders were plunged into debt and banks racked up losses of billions of dollars, many times more than the size of Iceland’s economy.
Today, the economy has recovered, partly thanks to booming tourism. But public anger still runs deep.
“We are a platform for young people, for progressive people who shape and reshape our society,” Ms. Jonsdottir told Agence France-Presse.
“Like Robin Hood, because Robin Hood was a pirate, we want to take the power from the powerful to give it to the people.”