Since Prime Minister Najib Razak's 2013 electoral victory, which was plagued by widespread allegations of gerrymandering, fraud and voter intimidation, Malaysia has taken a turn for the worse. Mr. Najib, who once promised democratic and economic reforms and pledged to allow "the voices of dissent" to be heard, has doubled down on political repression.

A former deputy prime minister of Malaysia and leader of the opposition, I am now in the fifth month of a five-year prison sentence that has been roundly condemned by governments and human-rights groups around the world. I spend my days in solitary confinement in meditation and in the company of the few books that are allowed into my cell. Meanwhile, allegations of corruption at the highest levels of Malaysian government have surfaced.

In 2012, the draconian Internal Security Act was repealed by the Najib government with much fanfare, only to be replaced by the Prevention of Crime and Prevention of Terrorism Acts, which are equally, if not more, repressive. Beyond encroaching on Malaysian citizens' fundamental liberties, these new laws rob judges of their discretionary sentencing powers.

Instead of abolishing the outdated and much-abused Sedition Act of 1948 as promised, Mr. Najib's government has deployed it as a weapon of mass oppression. In the past 18 months, more than 150 Malaysians have been arrested and many charged with sedition for an array of activities including accusing the government of voter fraud and criticizing the verdict in my trial. The arrested include students, professors, journalists, cartoonists, activists, human-rights lawyers and opposition politicians.

Mr. Najib's finance ministry's "strategic development fund," 1Malaysia Development Bhd., or 1MDB, founded by Mr. Najib in 2008, is under intense scrutiny. As this newspaper reported on July 2, Malaysian investigators "have traced nearly $700 million of deposits into what they believe are the personal bank accounts of Malaysia's prime minister, Najib Razak." Neither the original source nor ultimate destination of the money is clear.

A few weeks earlier, on June 18, this newspaper reported that during the 2013 election 1MDB "indirectly supported Prime Minister Najib Razak's campaign." The fund paid what appeared to be an inflated price for assets acquired from a Malaysian company; the company then contributed to a Najib-led charity that announced projects, such as aid to schools, that Mr. Najib was able to tout as he campaigned.

After these two stories were published, Mr. Najib's office put out a statement that "there have been concerted efforts by certain individuals to undermine confidence in our economy, tarnish the government and remove a democratically-elected prime minister." It called the Journal articles a "continuation of this political sabotage." Not surprisingly, foreign investors are increasingly wary. Malaysia's currency, the ringgit, recently fell to a 16-year low.

Meanwhile, the Najib government sows communal and religious animosity among the Muslim ethnic Malay majority and the country's large ethnic Chinese and Indian minorities. Mr. Najib's ruling coalition blamed a "Chinese tsunami" for its losing the popular vote in the 2013 parliamentary elections, regardless of a study showing this to be false. And despite Mr. Najib's claims of moderation internationally, the state-run media have vilified Shiite Islam. Last summer the prime minister urged his ruling United Malays National Organization members to be "brave" like Islamic State fighters in Iraq, causing him to later explain he doesn't support Islamic State or its radical brand of Islam.

Such actions undermine the fragile fabric of Malaysia's multiethnic and multireligious society. In four decades in public service I cannot recall a time when racial and religious sensitivities have become so inflamed, and at the same time so poorly managed by the country's political leadership.

Yet I stayed put in Malaysia to face a difficult third bout of unjust incarceration because we in the opposition believe in a brighter future made possible by good governance and the rule of law. We believe in the dismantling of Malaysia's system of race-based privileges that has devolved into nothing more than rent-seeking for the privileged few. We believe that corruption is a slow bleed that robs future generations of the education and business opportunities that will make them prosper.

Most important, we are joined by a new generation of young, millennial Malaysians with a commitment to building an inclusive, democratic and economically vibrant country.

Still, there is real danger ahead. Middle-income nations like Malaysia—after several decades of economic mismanagement, opaque governance and overspending—can devolve into failed states. The irresponsible manner in which the current leadership is handling religious issues to curry favor from the extreme right is fueling sectarianism. Increased political repression may drive some to give up on the political system altogether and consider extralegal means to cause change, thus creating a tragic, vicious cycle.

Yet there remains a clear path out of this mess: a return to the underpinnings of the Malaysian Constitution, which preserves and protects the rights of all Malaysians; a devolution of power from the executive, whose role now resembles that of a dictator more than a servant of the people; elections that are truly free and fair; and a free media unafraid to challenge authority.

Malaysia is ready for change. This is why, rather than flee my country, I chose to stay and continue the fight for peaceful, democratic reform from my prison cell. This is not easy and puts a tremendous burden on my family. I am grateful for their love and commitment. While I am physically behind bars my spirit remains with them, the people of Malaysia, and people all around the world who continue the struggle for dignity and for freedom.

Mr. Anwar, a former deputy prime minister of Malaysia (1993-98), is a former member of parliament for the People's Justice Party and until April was leader of the opposition.

On Friday, July 24, a unique political contest will take place in Kuala Lumpur: competing birthday parties for Prime Minister Najib Tun Razak and his nemesis, former Premier Mahathir Mohamad, who is determined to drive Najib from office.

The simultaneous events have Malaysia's elites trying to figure out which party to attend, or attend first, or for how long. It will be possible to attend both, but according to a politically well-wired source, both sides will be watching to see who is going to attend what party first, and for how long.

"The tan sris and datuks are in disarray," chortled a source, referring to titles bestowed on well-connected Malasyians.

Najib was born 62 years ago on July 23, Mahathir was born 90 years ago on July 10, but was unable to celebrate his birthday on that date because of the onset of Ramadan, the Muslim fasting month. Last year, both birthdays fell inside Ramadan, during which celebrations must be postponed.

Vincent Tan, the billionaire who owes much of his fortune to Mahathir's granting a non-tendered chance to buy the country's lucrative lottery in 1985, reportedly sent out invitations to Mahathir's party two months ago. As many as 1,000 people are expected to honor Mahathir at Tan's convention hall in his Berjaya Times Square shopping center.

Najib appears to have miscalculated. His birthday actually is July 23 but apparently, a source said, the planning got underway just a few weeks ago and it was decided to postpone it until tomorrow because it means the next day isn't a weekday. Reportedly Najib's private secretary has been calling political figures, businessmen and others, asking them to make sure they attend his party.

The war between Najib and Mahathir has been going on either behind the scenes or out front for more than a year. After months of back-room criticism, Mahathir in August 2014 took to his popular blog, Che Det, to announce that he had publicly withdrawn his support for the man he anointed in 2009 after playing a decisive role in driving Abdullah Ahmad Badawi from office.

Their relationship has grown increasingly bitter, with Mahathir accusing Najib of deep involvement in the disastrous 1Malaysia Development Bhd state-backed investment fund and hinting that he may have had something to do with the 2006 death of Mongolian translator and party girl Altantuya Shaariibuu at the hands of two of Najib's bodyguards, who were found guilty and sentenced to death. Najib has countered that Mahathir abandoned him because he refused to do the former premier's bidding on white elephant projects.