In an announcement on Twitter issued on Saturday morning, Rasmussen, who is still only 55 years old, said that he was now facing too much opposition from the party's grass roots.
“It’s important to maintain your self respect,” he said. “I can’t be the head of a party that denies me the chance to discuss and push forward the political line I established in the national congress forum in which I am elected. Thanks for the many good years.”
Rasmussen's announcement came after he left by the back door after a meeting of the party's leadership in the town of Vejle on the Jutland peninsular.
It follows months of increasingly open in-fighting within the party, both over whether he should remain leader and over who should replace him.
Rasmussen succeeded his near namesake Anders Fogh Rasmussen as prime minister in 2009, after the latter was appointed Secretary General of Nato.
He continued in the post until 2011, when he was ousted in a general election. He became prime minister once again in 2015, staying in the post until losing to the Social Democrats in this June's election.
Denmark's newspapers on Sunday saluted the wily operator's long career in politics.
“It was not a worthy end to an incredibly good political career for Løkke, crowned by two periods as prime minister,” Tom Jensen, editor of Berlingske newspaper, wrote. “It ended precisely as cruelly as one might have feared.”
Politiken editor Christian Jensen saluted a “masterful tactician and a political technocrat”, but said that by “setting his personal interests higher than the party's” and hanging on too long, he had left the Liberals “in a management crisis of historical proportions”.
Peter Orry, editor-in-chief of Jysk Fynske Medier, accused Rasmussen of “seeming to forget that power is always on loan.”
On Saturday evening, Rasmussen posted a picture of himself surrounded by family on Instagram.
“There's one thing which is more important than anything else: the family being together,” he wrote.
“Have a nice Saturday night.(and politics is all about making sure that all Danish families can have a good Saturday night – it is not an ideological project – it is common sense!)
In the run-up to Saturday's announcement, several of the party's regional groups publicly expressed their lack of confidence in Rasmussen, and the party's group in Central Jutland openly called for both him and Vice Chairman Kristian Jensen to resign, with several MPs joining the call.
On 21 September, the party is expected to vote in a new leader at an extraordinary meeting.