Danish Prime Minister Helle Thorning-Schmidt conceded defeat in Thursday's general election after an anti-immigration party scored a record vote to become the second-largest party and lifted the opposition right-wing bloc to victory.
The Danish People's Party (DF) became the largest right-wing party for the first time with 21.1 percent of the vote, giving the grouping 90 seats in parliament.
That compared to 85 for the centre-left bloc of Prime Minister Helle Thorning-Schmidt, who resigned as Social Democratic Party leader as she conceded defeat in the closely fought race.
Former premier Rasmussen is set to become the prime minister as DF, which backed right-wing governments between 2001 and 2011, has yet to say whether it would seek to join a right-wing government.
It could opt to remain outside government and provide informal support to the right-wing bloc in parliament to pass legislation.
"We are not afraid of being in government if that position gives us the greatest political influence," DF leader Kristian Thulesen Dahl told news agency Ritzau.
"It's not certain that they will give us the concessions needed," he added, referring to a potential right-wing coalition.
DF had campaigned on tighter immigration rules, higher pensions for low-income earners and more money for healthcare and the elderly.
See also: The rise and rise of the Danish People's Party
'We are taken seriously'
After the first exit polls were released, Dahl, visibly moved, sang the Liverpool FC anthem "You'll Never Walk Alone" as he took to the stage at a party event in the Danish parliament, cheered on by supporters.
"This election campaign has shown that we are a party that the others just can't avoid. We are a party to be taken seriously here in this country," he said.
A string of minor spending scandals undermined voter confidence in Rasmussen, whose party garnered 19.5 percent, losing more than one in four votes.
See also: PROFILE: Rasmussen banks on experience
"Venstre has lost support, we haven't had a very good election. But there is a majority of parties that think Denmark should have a new government," he said in his victory speech.
Immigration and the rising cost of housing asylum seekers was a major campaign theme for both right and left, along with the economy and the future of Denmark's cherished cradle-to-grave welfare state.
Denmark received nearly 15,000 asylum seekers last year, almost twice the number it received in 2013, as more people fled conflict and hardship in Africa and the Middle East to Europe.
Thorning-Schmidt, in power since 2011, and opposition bloc leader Rasmussen, who governed from 2009 to 2011, both tried to claim credit for a resurgent economy and wooed voters with pledges to curb arrivals.
Around nine percent of Denmark's 5.7 million inhabitants were born abroad.
DPP to set agenda
Analysts said that, regardless of whether or not it joined a coalition, DF would set the agenda for the new government. "The (Venstre) party won't be able to set the agenda for a right-wing government... That will instead be (DF leader) Kristian Thulesen Dahl," Lars Trier Mogensen, a political commentator at the Information newspaper, told tabloid Ekstra Bladet.
Others suggested DF would have to join a right-wing government even if it meant the party, often accused of populism, would have to "take responsibility".
"DF can't duck anymore. It would be to betray their voters if they don't join the government now," Sos Marie Serup, a political commentator at the BT tabloid, said.
"The right-wing voters have told the Danish People's Party that they must assume responsibility," she said.
Thorning-Schmidt's approval ratings were stuck in the doldrums for most of her four-year tenure as the economy dipped in and out of recession and her centre-left coalition implemented policies viewed as right-wing, including welfare cuts and corporate tax reductions.
But she rebounded in opinion polls after calling the election three weeks ago as economic growth returned - it is expected to reach 1.7 percent this year - and after taking a tough stance on immigration.
Unusually for a Social Democrat, Thorning-Schmidt campaigned on the slogan "If you come to Denmark you should work". Her government had also introduced temporary residence permits for refugees, as part of its efforts to stem an influx of asylum seekers.
Rasmussen has said he would cut back the number of asylum seekers by slashing benefits for new immigrants and by making it harder to obtain permanent residency.