COPENHAGEN, Denmark (AP) — Denmark's center-right opposition won a parliamentary election after strong gains by an anti-immigration party that wants to limit the European Union's influence over the small Nordic country.
With all votes counted, preliminary official results showed the opposition bloc led by Lars Loekke Rasmussen, a former prime minister, would get the 90 seats needed to secure a majority in the 179-seat legislature.
"Four years ago we handed over the keys to the prime minister's office. I then said it was only a loan," he told supporters in Copenhagen. "There is a majority that believes that Denmark needs a new government and gives us a possibility to get the keys back."
His main opponent Helle Thorning-Schmidt conceded defeat, saying she would resign as prime minister and leader of the Social Democratic Party on Friday.
"We were beaten on the finish line," said Thorning-Schmidt, Denmark's first female leader. "I know that Lars Loekke (Rasmussen) loves Denmark and he should be happy that he takes over a Denmark that is in great shape."
Loekke Rasmussen's own Liberal Party lost 7 percent of its support and was surpassed by one of its allies, the Danish People's Party, as Denmark's second biggest political group.
That party, which is opposed to immigration and skeptical of the EU, surged to 21 percent, helping the opposition get 51.5 percent of the vote, the results showed.
It wasn't immediately clear whether his party would seek Cabinet posts or try to use its leverage in Parliament to influence the government, like it did before 2011.
"The most important for the Danish People's Party is to get political influence," party leader Kristian Thulesen Dahl said.
Loekke Rasmussen was expected to become prime minister, because he has the support of the other members of the bloc.
Before the vote, the opposition parties endorsed British Prime Minister David Cameron's bid for EU reforms, which suggests that Denmark, too, may consider a looser relationship with the union.
The Danish People's Party has called for Denmark to take back more authority from the EU headquarters in Brussels and for border controls to be reintroduced on the boundaries with Germany and Sweden. That's controversial among many EU members who feel it would challenge the spirit of a borderless Europe.
Election campaigns focused on welfare spending, the economy and immigration, with both Thorning-Schmidt and Loekke Rasmussen promising to further tighten Denmark's controls on immigration.
"I want an open Denmark, but I also want a Denmark that is efficiently shut for people who don't want our country," Loekke Rasmussen told reporters when he voted Thursday.
Thorning-Schmidt, who is married to British Labour lawmaker Stephen Kinnock, lost the election even though her Social Democratic Party improved slightly and remained Denmark's largest party. The smaller members in her coalition lost support.
An exit poll by broadcaster TV2 had projected a smaller margin that would have given the semi-autonomous Faeroe Islands and Greenland the decisive votes. The North Atlantic territories have two seats each in the legislature.
However, even though all four seats ended up going to Thorning-Schmidt's coalition, it wasn't enough. Her block got 89 seats in total, one short of a majority.
Associated Press video journalists David Keyton and Donogh McCabe contributed to this report.