An angry crowd had gathered at a Kuala Lumpur airport, shouting at vehicles and seeking to stop them entering, after a purported flight itinerary leaked online showed Najib and his unpopular wife were planning to head to Indonesia.
Later Saturday, Najib - who has been under growing pressure from inside his Barisan Nasional (BN) coalition since this week's landslide loss - announced he was quitting as head of BN as well as its main party.
The coalition's defeat in the election at the hands of an alliance led by his one-time mentor Mahathir Mohamad amounted to a political earthquake, which toppled an increasingly authoritarian regime that had ruled the country for six decades.

Malaysians gather in front of Subang Airport in an attempt to prevent defeated prime minister Najib Razak from leaving the country. Source: AAP
At 92, Mahathir is the world's oldest state leader. The former autocrat previously served as prime minister for over two decades and was a BN stalwart.
But he came out of retirement and defected to the opposition in a bid to unseat Najib over allegations that huge sums were looted from sovereign wealth fund 1MDB, which Najib set up and oversaw.
Since the opposition victory, Malaysia's king has agreed to pardon jailed top politician Anwar Ibrahim - a former nemesis turned ally of Mahathir - in a move that could pave the way for him to become premier. Senior members of his party said he was expected to be freed Tuesday.
'Blacklisted'
Speculation had been mounting that Najib might try to flee the country as Mahathir has pledged to investigate the 1MDB controversy if he won power.
As an image of the leaked manifest for a flight to Jakarta spread like wildfire online, Najib insisted in social media posts he was planning only a "short break" overseas to rest after the election and would be back next week.
But anger quickly mounted among social media users who accused the defeated leader of seeking to flee, and the immigration department swiftly announced both he and his wife Rosmah Mansor were banned from leaving Malaysia.
Mahathir confirmed he had issued the order to stop the pair leaving.
"It is true that I prevented Najib from leaving the country... he and his wife," he told a press conference.
Najib said in a tweet: "I respect the decision and I will remain in the country with my family."
Rosmah has long been a lightning rod for public anger in Malaysia due to her reported love of luxury shopping trips and vast collection of designer handbags.
When asked if the restrictions on Najib were due to 1MDB, Mahathir said: "There are a lot of complaints against him all of which have to be investigated... we find that some of the complaints are valid.
"We have to act quickly because we don't want to be saddled with a problem of extradition from other countries."

Malaysia's Prime Minister Mahathir Mohamad with Wan Azizah, wife of Anwar Ibrahim and Deputy Prime Minister-designate. Source: AAP
Anwar release
Earlier, as dozens of people descended on the airport in a bid to stop Najib and Rosmah leaving, riot police were stationed by the gate of the airport where it was believed Najib would enter.
As a white van with heavily tinted windows attempted to pass by, the crowd surrounded the vehicle and demanded it be opened so they could see who was inside.
It was only allowed to pass after those inside rolled down a window to prove Najib was not in the van.

Former Malaysian PM Najib Razak at the 72nd anniversary of the United Malays National Organisation in Kuala Lumpur. Source: AAP
In an emotionally charged press conference later, Najib announced he was stepping down as chairman of BN and president of its main party, the United Malays National Organisation (UMNO), following the historic loss.
"If the party failed in the general election, the leader has the moral obligation to step aside," he said.
Mahathir also announced the first three appointments to his cabinet -- Lum Guan Eng as finance minister, Muhyiddin Yassin as interior minister and Mohamad Sabu as defence minister.
Xavier Jayakumar, a vice-president of Anwar's party, said the jailed politician was expected to be released from prison Tuesday.

Malaysian police guard the airport entrance in Subang Jaya over fears Najib Razak may flee the country. Source: AAP
Anwar was heir-apparent to the premiership until Mahathir sacked him in 1998 and he was subsequently jailed for sodomy and abuse of power.
But in a turnaround remarkable even in the head-spinning world of Malaysian politics, the pair reconciled and joined forces as allegations mounted over 1MDB and Najib became increasingly authoritarian.
Anwar, now 70, was jailed again in 2015 during Najib's rule and had been due for release next month.