Even before the order to dissolve Parliament was announced on Friday, flags for the National Front began appearing at overpasses and major intersections in Kuala Lumpur, the nation’s capital. Banners for opposition parties, which are expected to band together under the People’s Justice Party in order to contest the elections, were not on display.

Two controversial bills were passed in the waning days of Parliament. One rejiggered voting districts so drastically that the opposition derided it as gerrymandering. Another piece of legislation made creating or circulating “fake news” punishable by up to six years in prison. The definition of “fake news” has not been made clear.

Earlier this week, Mr. Najib promised to give raises to Malaysia’s 1.6 million civil servants, most of whom are Malay. The prime minister also vowed to lavish hundreds of millions of dollars on police officers and certain companies run by bumiputra, or sons of the soil, as Malays and indigenous peoples are known.

Dr. Mahathir was the architect of the affirmative action program for Malays, who were discriminated against during British rule. Encouraging mass immigration by Chinese and Indians, the British also gave some prime jobs in the colonial administration and business sphere to non-Malays, fostering resentment that festers to this day.

Pakatan Harapan, Malaysia’s opposition coalition, is an unwieldy collection of disparate forces that includes Chinese liberals, Islamists and nationalist Malays. Meaning “alliance of hope” in Malay, it is led by Dr. Mahathir, even though some of the coalition’s most prominent members are veteran opposition leaders who were jailed or harassed during the former prime minister’s long tenure.

Chief among them is Anwar Ibrahim, a former deputy prime minister to Dr. Mahathir who fell out of favor and was jailed on sodomy and graft charges that were widely seen as politically motivated. Mr. Anwar famously appeared in court in 1998 with a black eye that Dr. Mahathir’s allies insisted was self-inflicted.