Former Malaysian Prime Minister Najib Razak (center) at a press conference after the 2018 general elections.

Ousted Malaysian Prime Minister Najib Razak quit as leader of his UMNO party as well as coalition alliance Barisan Nasional on Saturday.

"We all feel sad about what happened but as a party that upholds democratic principles, we accept the people's decision," he said, referring to the stunning defeat of the long-ruling alliance in Wednesday's general election.

This follows news earlier on the same day that he and his wife Rosmah Mansor have been blacklisted from leaving the country, according to immigration authorities.

Najib, 64, lost to former Prime Minister Mahathir Mohamad in this week's general election.

Mahathir, who was sworn in as prime minister on Thursday, has vowed to investigate a multi-billion-dollar graft scandal at state fund 1Malaysia Development Berhad (1MDB), which was founded by Najib.

"We are not seeking revenge," he had said. "What we want is to restore the rule of law ... if the law says that Najib has done something wrong, then he will have to face the consequences."

On Saturday, Mahathir said that he was behind the move to prevent Najib from leaving the country, to avoid any extradition problems.

In a tweet following this statement, Najib said that he will respect the government's decision on the ban.

"I have been informed that the Malaysian Immigration Department will not allow my family and me to go overseas," Najib said in the tweet.

"I respect the directive and will remain with my family in the country."

News broke in 2015 that about $700 million allegedly stolen from 1MDB had made its way into Najib's personal bank accounts.

He denied any wrongdoing and was cleared by Malaysia's attorney-general, even as U.S. authorities alleged that over $4.5 billion was stolen from the fund in a fraud orchestrated by a financier known to be close to Najib and his family.