Smer-Social Democracy is projected to hold 49 seats in the 150-seat Parliament, compared with the 83 seats it won in 2012, when it had 44 percent of the vote. The second-place party, Freedom and Solidarity, earned 12 percent of the vote, or 21 seats. The Ordinary People party picked up 11 percent of the vote, while the Slovak National Party, a potential partner for Mr. Fico, received nearly 9 percent, according to official results.

Mr. Fico’s party ran on an anti-migrant platform, but the biggest surprise was the success of the extreme-right People’s Party-Our Slovakia, whose leader, Marian Kotleba, has said, “Even one immigrant is one too many.” Mr. Kotleba, a regional governor, has past ties to neo-Nazism. His party picked up 8 percent of the vote, or 14 seats, and could pose an obstacle in Mr. Fico’s efforts to form a coalition.

Mr. Kotleba has spoken favorably of the Slovak state during World War II and of its leader, Jozef Tiso, who was responsible for sending tens of thousands of Jews to concentration camps. Mr. Kotleba has referred to NATO as a “criminal organization” and has railed against the United States, the European Union and immigrants.

He is not expected to be offered a role in forming a new government, or to seek one. “We don’t want to join any of the sides at all costs,” Mr. Kotleba said Sunday in a discussion at TV Markiza. “We have our clear values, our pillars — national, Christian and social pillars — and I think that both sides would mean a debacle for these values.”

Still, the elections make it most unlikely that Slovakia will soften its opposition to being obligated to accept migrants under a European Union quota system. “We will continue to be the troublemaker in this, but we’re not alone,” said Grigorij Meseznikov, the president of the Institute for Public Affairs here.