The polls produced no clear winner, sparking a flurry of behind-the-scenes negotiations. The palace made the decision to name Anwar after the hitherto ruling United Malays National Organization (UMNO), which suffered a stinging electoral defeat, agreed to support him.
Anwar's elevation caps a dramatic political career in which he tried and failed to become prime minister three times, and also spent time in jail on charges many believed were trumped up.
Read our full coverage.
Here are the latest updates (local time):
Thursday, Nov. 24
11:00 p.m. Anwar Ibrahim addresses a news conference for the first time as prime minister, pledging to fight corruption and oversee a multiracial Malaysia under progressive leadership. "There will be no questions of instability in my administration," he says, with his wife, Wan Azizah Wan Ismail, by his side. "I have asked for the government to put in a motion of confidence as the first agenda on Dec. 19."
5:12 p.m. Opposition leader Anwar Ibrahim is sworn in by King Sultan Abdullah Sultan Ahmad Shah at the National Palace in Kuala Lumpur, becoming Malaysia's 10th prime minister.
1:40 p.m. Opposition leader Anwar Ibrahim has been appointed the new prime minister, the palace says after the king held a special meeting with rulers of nine states. He is to be sworn in at 5 p.m. local time.
10:10 a.m. Rulers of nine Malaysian states begin a special meeting with King Sultan Abdullah Sultan Ahmad Shah at the National Palace in Kuala Lumpur to discuss the political stalemate since the federal election on Nov. 19. The rulers are also expected to deliberate on the decision made by United Malays National Organization (UMNO) to extend support to a unity government led by Hope Pact leader Anwar Ibrahim. The meeting is expected to end in the afternoon and a statement on the country's 10th prime minister is likely afterward.
1:15 a.m. The United Malays National Organization will support Hope Pact leader Anwar Ibrahim to be the country's 10th prime minister, amid four days of deadlock after the general election resulted in Malaysia's first-ever hung parliament. UMNO leads the National Front coalition, which won 30 seats in the lower house.
UMNO said in a statement early Thursday that the party will not support the National Alliance led by former Prime Minister Muhyiddin Yassin.
UMNO, which initially declined to support either Anwar or Muhyiddin, was compelled to take part in a unity government by the king amid the stalemate. The two men are in the running to be the next leader.
Wednesday, Nov. 23
1:50 p.m. The king will meet his fellow rulers from Malaysia's states at a special palace gathering on Thursday at 10:30 a.m. local time, to seek their opinions on how to end the political impasse after Saturday's general election ended without a clear winner. Local media reports say the meeting is expected to last three hours or longer.
King Sultan Abdullah Sultan Ahmad Shah met lawmakers from the incumbent ruling National Front coalition on Wednesday, which lost the election and has refused to support either prime minister hopeful, Anwar Ibrahim or Muhyiddin Yassin. Wednesday's meeting does not appear to have produced a solution to the stalemate.
Tuesday, Nov. 22
6:45 p.m. Muhyiddin Yassin of the National Alliance coalition says the king proposed that his party work together with Anwar Ibrahim's Hope Pact to form a unity government. Muhyiddin says he turned down the proposal, citing key issues that prevent the coalitions from working together.
Muhyiddin, who had an audience with the king, remains steadfast that his National Alliance has support of 115 lawmakers, more than the needed 112 nominations to form a simple majority.
"Yesterday we have sent statutory declarations from 115 members of parliament and this was acknowledged by the king's private secretary," says the former prime minister. "However, when I met the king today, I was told it's not enough for unknown reasons," he adds.
6:40 p.m. Malaysia's king has summoned all 30 lawmakers from the National Front coalition to the palace on Wednesday at 10:30 a.m., after a meeting with Hope Pact leader Anwar Ibrahim and National Alliance rival Muhyiddin Yassin on Tuesday did not result in the formation of a new government.
The palace says the audience with the National Front lawmakers will be an extension to Tuesday's discussion. The king has also advised all Malaysians to be patient and calm until the government formation process and appointment of the 10th prime minister are complete.
The National Front, which ruled the country before the election, has emerged as the deciding factor despite suffering its worst result at the polls. Without the support of the coalition, neither the Hope Pact nor the National Alliance will be able to secure the minimum majority of 112 seats needed to form a government.
5:50 p.m. Malaysia's king has not made a decision on who will become the next prime minister, Hope Pact leader Anwar Ibrahim says after meeting with the monarch and National Alliance rival Muhyiddin Yassin.
Anwar, speaking to reporters outside the palace complex, says there was no conclusion made even though a few news outlets had quoted sources as saying that he had been appointed interim prime minister.
4:30 p.m. The Malaysian king is meeting with Hope Pact's leader Anwar Ibrahim and former Prime Minister Muhyiddin Yassin of the National Alliance at the National Palace to discuss the formation of the next federal government, after both leaders failed to gain the support of at least 112 lower house members after the election on Saturday.
The police's light strike force personnel are guarding the palace complex in Kuala Lumpur to control supporters of Anwar and Muhyiddin.
2:10 p.m. Malaysia's incumbent ruling National Front coalition says it will be in opposition after deciding not to support any coalition to form a government, the country's incumbent Prime Minister Ismail Sabri Yaakob said on Twitter.
In Saturday's election, the Anwar Ibrahim-led Hope Pact coalition won 82 seats, followed by the National Alliance chaired by former Prime Minister Muhyiddin Yassin on 73. The National Front won 30 of the available 220 seats.
Both coalitions have since been horse-trading to form a government.
But with the National Front backing out, neither coalition will be able to gain the majority needed to form a stable government, unless the National Alliance and Hope Pact combines.
Malaysia's palace said the king would make a decision about the appointment of a politician to lead the country soon.
5:00 a.m. Efforts to form a new Malaysian governing coalition continue, with both former Prime Minister Muhyiddin Yassin and Anwar Ibrahim claiming to have majority support following Saturday's election.
Muhyiddin, leader of the National Alliance, said Monday evening that he submitted statutory declarations to the king naming more than 112 lawmakers -- the minimum needed to form a governing majority in parliament.
But the king extended the deadline for such submissions to 2 p.m. Tuesday local time.
Anwar, leader of the Hope Pact, held talks with the National Front -- his former nemesis -- and also claimed to have enough supporters for a majority, including the 30 National Front members who won parliamentary seats in the election.
Anwar and Muhyiddin are expected to submit names to the palace before Tuesday's deadline, with the king likely deciding in the evening, exercising his authority under the country's constitution to appoint the prime minister.
Monday, Nov. 21
1:45 p.m. The Malaysian king has extended by 24 hours the deadline for parties to form a new government, to 2 p.m. on Tuesday, as the National Alliance's Muhyiddin Yassin and the Hope Pact's Anwar Ibrahim scurry to persuade smaller parties for support. "The king has called upon the people to be patient and be calm until the new government formation and naming of the 10th Prime Minister is completed," the statement from the Palace reads.
Muhyiddin, the first to claim to have won over a majority of the newly elected lower house members, has received the support of Borneo parties that won a cumulative 28 seats. Anwar, meanwhile, was seen in a discussion with the National Front on Monday afternoon in Kuala Lumpur. The National Front, led by Ahmad Zahid Hamidi, won 30 seats in the lower house election held on Saturday. Hope Pact officially won 82 seats. A coalition will need at least 112 to form a government.
Sunday, Nov. 20
2:20 p.m. The palace issues a statement asking leaders of political parties to submit their coalition of choice by tomorrow 2 p.m. local time. The king is then expected to make a final decision to end the political uncertainty after the Saturday general election ended with an unprecedented hung parliament, leaving no parties and coalitions able to prove a majority.
3:45 a.m. Opposition leader Anwar Ibrahim claims his Hope Pact coalition also has enough support from lawmakers to form the next government without providing details about which lawmakers or political parties are backing him. Hope Pact officially won 82 seats, which is less than half the 222 total lower house seats.
"I am announcing that we have obtained the majority [of seats]. Majority means more than 111 seats," Anwar told reporters. "We have to first submit documents to the King. [Hope Pact] has the biggest bloc and we have the understanding to form the government," added Anwar.
3:20 a.m. National Alliance coalition leader Muhyiddin Yassin declares his alliance will form the next government in collaboration with other parties. The National Alliance, which so far has won 70 seats, is expected to work together with National Front, which has 30 seats, and the Borneo parties, which secured 31 seats so far. Muhyiddin, however, did not commit to any agreements with any parties and added that all negotiations will be completed by Sunday evening.
3:15 a.m. Anwar wins the Tambun seat in the northern state of Perak by 3,736 votes. He defeats former federal minister Faizal Azumu, who represented the National Alliance coalition.
2 a.m. The election commission reports that of the 222 seats being contested, the National Alliance led by former Prime Minister Muhyiddin Yassin is narrowly leading with 62 seats, ahead of the Anwar Ibrahim-led Hope Pact's 61. The ruling National Front has so far claimed 26 seats.
12:00 a.m. The Anwar Ibrahim-led Hope Pact has officially won 28 seats and is seen leading in 65 constituencies, while the National Alliance led by former leader Muhyiddin Yassin has been declared winner in 26 seats while leading in 43 seats. The ruling National Front is seen winning 15 and leading in 18 seats.
Saturday, Nov. 19
11:50 p.m. Former prime minister Mahathir Mohamad has failed to defend his Langkawi parliamentary seat, an unofficial count confirms. He lost his deposit after failing to gain at least 20% of votes cast.
Mahathir, 97, who served twice as the country's prime minister for a cumulative 24 years, was trailing the winner from the National Alliance by more than 11,000 votes.
This is Mahathir's first defeat in parliamentary elections since 1969. He was vying for his 10th term as a federal lawmaker
Mahathir told Nikkei Asia in a recent interview that he would retire if he lost his seat.
Separately, Prime Minister aspirant Anwar Ibrahim, who leads the Hope Pact coalition, won the Tambun constituency in northern Perak state by more than 4,100 votes, an unofficial count shows. He defeated former federal minister Faizal Azumu, who represented the National Alliance coalition.
10:35 p.m. National Alliance chairman and former Prime Minister Muhyiddin Yassin wins the Pagoh seat in the southern state of Johor, reports state news agency Bernama.
Meanwhile, an unofficial count shows Anwar Ibrahim's Hope Pact leading in 64 constituencies, the Muhyiddin-led National Alliance leading in 39 constituencies and the National Front, which includes UMNO, ahead in 19 seats.
9:20 p.m. The Anwar Ibrahim-led Hope Pact is seen leading in 54 constituencies, while the National Alliance led by former leader Muhyiddin Yassin is ahead in 37, based on unofficial figures. The ruling National Front is seen trailing, with an edge in just 17 constituencies. Vote counting continues and is at various stages nationwide.
8:20 p.m. The Anwar Ibrahim-led Hope Pact is seen leading in 47 constituencies, while the National Front is seen ahead in 13. The constituencies are at various stages of counting.
The unofficial results come from the respective state voting centers, where the official numbers will only be announced after the conclusion of all votes in a constituency
7:00 p.m. The latest turnout data, as of 4 p.m., shows a ratio of 70%, or 14.8 million voters.
6:00 p.m. It's closing time at the polls. Now we wait for the results to trickle in.
Ballot boxes will be sealed by Election Commission officials and transported to the counting centers. Each parliamentary constituency will have one counting center.
As of 3 p.m., turnout stood at 65%, or 13.7 million people.
5:25 p.m. The Election Commission has suspended voting in Baram, on the island of Borneo, due to bad weather. This means the total seats up for grabs on Saturday will be 220, instead of the original 222. A separate polling date will be announced in due course for Baram as well as Padang Serai, where the vote was postponed until next month due to the sudden death of a candidate.
3:55 p.m. Some Malaysians used the occasion to engage in some cosplaying, showing up to cast their ballots dressed as superheroes like Captain America, Predator, Iron Man and Power Rangers.
3:50 p.m. Over 12.2 million voters had cast ballots as of 2 p.m., 58% of all those eligible.
3:45 p.m. Turnout is one key factor to watch. Another is how younger citizens vote. As many as 1.4 million of the 21.17 million eligible voters are first timers, after the minimum age was lowered to 18 from 21.
2:15 p.m. The Election Commission says 50% of voters had cast their ballots by 1 p.m., a slower pace than in 2018 when the percentage at the same time was 55%. However, this year the voter base is larger, and the number of voters having cast their ballots by 1 p.m. was 10.5 million, compared to 8.22 million four years ago.
2:00 p.m. The meteorology department warns of thunderstorms and heavy rain in the southern state of Johor and in some parts of Sabah state, on Borneo island.
1:50 p.m. The country's Election Commission tweets that by noon 42% of voters had cast their ballots. Turnout for the last federal election, in 2018, was 82%.
1:20 p.m. The skies above the capital clear up after a morning drizzle, but local media report that voters in the interior areas of the state of Sarawak, on Borneo, are braving floodwaters to cast their ballots.
1:00 p.m. Former prime ministers Mahathir Mohamad and Muhyiddin Yassin appear at their polling stations to cast votes.
11:10 a.m. Anwar Ibrahim, who leads the opposition coalition Hope Pact, arrives at a polling center in Penang state and casts his vote alongside many other citizens. Ismail Sabri Yaakob, prime minister and vice president in the ruling UMNO, is also seen casting his ballot in Bera, Pahang state.
8:00 a.m. Election day is underway as the polls fully open. A key question is how the monsoon season might affect turnout. The Meteorological Department gave a mixed forecast for election day, with rain expected in some parts of the country.
7:00 a.m. Pollster Merdeka Center For Opinion Research in its latest survey on Friday projected opposition coalition Hope Pact to lead with 82 seats, out of 221, followed by National Alliance with 43. UMNO-led National Front is expected to garner 15 seats, with 45 considered a tossup.