BRATISLAVA, Slovakia — The longtime governing party in Slovakia suffered a sweeping defeat in national elections on Saturday, paving the way for a new government coalition that promised to fight corruption and promote the rule of law.
The leader of the largest opposition party, Igor Matovic, vowed to make the most of the moment.
“We took a difficult road during this campaign,” said Mr. Matovic, the leader of the Ordinary People and Independent Personalities party, or OLANO. “We tried to wake up a sleeping dragon. We are very happy that Slovakia has woken up.”
The election — in which Mr. Matovic’s party won 25 percent of the vote, compared with 18 percent for the governing party, SMER-SD — was the culmination of one of the most turbulent periods in Slovak politics. And the issues convulsing the small Central European country are the same ones coursing through democracies across the former Soviet bloc.
Populists hope to tap into public anger by appealing to an aggrieved sense of nationalism, often competing with progressives who cling to the flag of the European Union as a symbol of a future that brings the Continent’s nations closer, not further apart.
The election results come two years after the killings of an investigative journalist, Jan Kuciak, and his fiancée, Martina Kusnirova, shocked Slovakia and upended the political order, led to the resignation of Prime Minister Robert Fico and left the governing party, SMER-SD, reeling.
In the void, several forces have emerged.
In the Slovak National Uprising Square in Bratislava, under a plaque commemorating the 1989 Velvet Revolution that paved the way for the country’s eventual independence, flowers and candles pay tribute to Mr. Kuciak. He has become a symbol for another revolution: a battle against powerful oligarchs and deep-rooted corruption that has led to the lowest levels of public trust in the state and its institutions in two decades.
The wave of protests after the killings helped fuel the election last year of the country’s first female president, the environmental lawyer Zuzana Caputova.
But just down the street, in a small bookstore called Knihy LIC, the owners were promoting a special on books about Marian Kotleba, the leader of the neo-fascist People’s Party Our Slovakia, and totalitarian ideologies.
Mr. Kotleba’s party has grown in popularity across the country since it surprisingly entered Parliament in 2016 and after winning roughly 8 percent of the vote Saturday, it will remain a voice of opposition to the new government.
Yet in recent weeks OLANO surged to the top of the polls, in many ways capturing the political chaos of the moment. Led by Mr. Matovic, a regional media owner, it started as an anticorruption movement over a decade ago but it has only now caught fire.
Beyond the party’s claims to want to combat systemic corruption, it does not have a coherent political vision. Instead, it cast a wide net for candidates in the national election, drawing on activists, politicians, public figures, teachers and even a comedian and a tennis player.
Michal Vasecka, a sociologist at the Bratislava Policy Institute, described the party as “chameleon-like.”
“It can switch between different attitudes while still keeping the anticorruption line,” he said.
Campaigning under the slogan “Together Against the Mafia,” Mr. Matovic ran a campaign unlike any other seen before in the country.
In January he flew to Cannes, France, and filmed himself on the doorstep of an opulent villa owned by a former finance minister and longtime SMER-SD member. “Bonjour, mafia,” he said before stating that the house was a property of the Slovak Republic.
A few weeks later, he went to Cyprus and found the mailboxes of dozens of shell companies connected to PENTA, an oligarch-owned financial group, seeking to demonstrate how the powerful avoid paying taxes.
He also gained notoriety for stunts that angered many of the people he would need to work with to form a coalition government — including throwing a bag full of empty syringes over the head of a fellow opposition lawmaker after disapproving of a newspaper interview the lawmaker gave about drugs, and holding a sign saying, “He is drunk,” next to the speaker of Parliament during a recent session.
In an interview before the election, Mr. Matovic defended the unconventional campaign. “As to us being nonstandard — yes, we are,” he said. “But all of the things that happened here in the past few years have not been standard politics either.”
Mr. Matovic said his party would represent the country with dignity. “The West doesn’t need to worry,” he said. “They can be happy. The world finally won’t have to be ashamed of Slovakia.”
Asked about the party’s politics beyond the issue of corruption, he said it had cast a large net on purpose. “Our movement and our ticket are essentially mirroring Slovakia,“ he said. “It’s not one color or black and white. It’s colorful.”
Many opposition groups in Eastern and Central Europe have failed to beat more entrenched parties because they could not unify around a single person or party. That division has allowed governing parties to maintain a grip on power even if they do not have majority support from the public.
Before the election on Saturday, all of the leaders of possible coalition parties vowed to work together to offer an alternative to SMER-SD.
“I will do everything in my power to show that we can be responsible, stable and so that mafia that will be waiting for our mistakes would have no chance of coming back to power,” Mr. Matovic said.
Yet at the same time, public anger has also fueled the rise of Mr. Kotleba and his party, an ascension — boosted by dozens of Facebook pages filled with hoaxes, hateful and racist content that gathered support among young people — that many Slovaks have watched in horror.
“We are the sword that can protect Slovakia,” Mr. Kotleba said last month at a “blessing” ceremony at a small church on a hill above Drazovce, about 40 miles from Bratislava. He promised to protect the country from the decadent West, “Islamization” and the “L.G.B.T. agenda.”
Besides Mr. Kotleba, who faces trial this month over the promotion of neo-Nazi symbols, his party’s ticket includes people convicted of extremist or racist crimes.
Before the results came in, Karolina Farska, 21, a student who organized the protests against Mr. Kuciak’s killing, said that this election was unlike any in recent history — and that the choice was a stark one.
“These elections are not the same as we see every four years,” she said. “I really think this is a referendum about what kind of country we really want.”