KYIV, Ukraine — Maksym Melnichenko flew through the first stage of tests meant to weed out the corrupt and incompetent from Ukraine's notorious prosecution service. He answered 100 computer questions in 100 minutes to pass with flying colors. Two weeks later, he passed stage two, an IQ test, scoring a 116.

Then came stage three: the interview. Ninety minutes of questions about his overseas trips and the property of his wife, mother and parents-in-law was enough to raise “reasonable doubt” about his integrity, the investigating commission said. Melnichenko, like hundreds of other prosecutors, was sacked.

Anti-corruption activists call it the most sweeping reform of the prosecution system in Ukraine’s history. To Melnichenko, 37, a father of three young children, and to hundreds of other prosecutors appealing their firings in court (where judges are also known for corruption), it’s a travesty.

Now anti-corruption activists see a different travesty: the dismissal of Ruslan Ryaboshapka, the prosecutor general who instigated the anti-corruption drive, replaced Tuesday by Iryna Venediktova, a former adviser to President Volodymyr Zelensky and lawmaker from his party.

Ryaboshapka was fired by parliament on March 5 after six months on the job. He was pushed out by a faction in Zelensky’s Servant of the People party that anti-corruption crusaders and political analysts say is close to the powerful oligarch Ihor Kolomoisky. (Kolomoisky and the lawmakers deny any links.)

Zelensky is a former comedian who played the president on the television show “Servant of the People” before winning the office last April. The show was aired by Kolomoisky’s network.

Zelensky said Ryaboshapka had failed to produce results. But the sacking shocked observers. His attack on corruption in the prosecution service was seen by good-governance advocates as a seismic reform. Yet here was the populist president — a man whose broad-based political support gave him the best chance in decades of modernizing Ukraine’s ossified and corrupt political and law enforcement institutions — abruptly veering away from a crucial reform of the prosecution service toward . . . what, exactly?

Ryaboshapka’s firing came just after Zelensky removed the young reformist prime minister, Oleksiy Honcharuk, and most of his government after less than a year on the job.

“Shame is the only word I can use to describe what has happened in parliament,” journalist Kristina Berdynskykh tweeted earlier this month. “Zelensky has made a sharp turn in what is obviously the wrong direction.”

Daria Kaleniuk, head of Ukraine’s Anti-corruption Action Center, said the moves send the message that Zelensky “can fire a person who takes a risk, for doing the right things, and blame this person for inefficiency.”

“It feels that his agenda is being built by either very non-competent forces or very pro-oligarch and pro-Russian forces,” Kaleniuk told The Washington Post. “I think that it’s just a matter of time, when pro-Russian forces and pro-oligarch forces fully hijack the president.”

A spokeswoman for Zelensky did not respond to questions about the criticism of Ryaboshapka’s dismissal. Spokeswoman Iiuliia Mendel sent an excerpt from a Zelensky address on March 4, in which he said he did not influence the work of prosecutors and called for them to work more quickly and prosecute more people.

“For how long should Ukrainian society expect the results in the most resonant cases?” he asked. “We promised citizens a victory over corruption. Now it’s not even a draw.”

Ryaboshapka’s replacement, approved by the parliament Tuesday, disappointed anti-corruption advocates. Kaleniuk called Venediktova, head of the State Bureau of Investigations, “completely unsuitable,” predicting in a Facebook post that she would do whatever Zelensky wanted.

“Those who always say yes will simply bring both the president and the country to a deep, deep bottom,” she said.

Zelensky told parliament Tuesday that Venediktova’s professionalism and integrity would ensure an end to corruption and see important cases prosecuted.

Venediktova told parliament she would comply with the law and ensure that the prosecution service met international standards.

“I promise not to sell criminal cases, not to sabotage them and not to reinstate werewolf prosecutors,” she said. “We need justice like air, and we will restore it.”

She rejected accusations that she was appointed to initiate political prosecutions: “There is no political persecution in Ukraine, but a thief must be in jail.”

Zelensky boasted to President Trump last year in the telephone call that raised controversy for both that Ryaboshapka would be “100 percent my person.”

The July 25 conversation, in which Trump asked Zelensky to launch investigations into his political rival Joe Biden and his son Hunter led to his impeachment. (He was acquitted by the Senate.)

Trump’s pressure came at a delicate time for Ukraine, as Ryaboshapka and other reformers worked to shake the country free from decades of corrupt, incompetent governance. Zelensky’s claim that Ryaboshapka was 100 percent his man was damaging in a nation where the prosecution service has long been used as a Soviet-style political tool to jail political rivals.

Ryaboshapka, knowing that powerful opponents were circling, moved quickly to reshape the service. One of the first things he did was fire two deputies and the chief prosecutors in 17 of Ukraine’s regions.

As Trump pressured Zelensky, Ryaboshapka said publicly that he saw no evidence of criminality by Hunter Biden. He launched audits of at least 15 investigations into the Ukrainian gas company Burisma in the era before Hunter Biden joined the board.

Viktor Chumak, Ryaboshapka’s deputy and, until Tuesday, his interim successor, called his former boss “the most successful prosecutor in the history of Ukraine.”

“You understand, before the arrival of Ryaboshapka, the prosecutor’s office was an instrument of repression and pressure,” Chumak said in an interview before Venediktova was appointed. “And it was an instrument of political games. It was an instrument of pressure on political opponents.

“The one who broke that system was Ryaboshapka. Everything began to be done according to the law.”

Chumak blamed Ryaboshapka’s firing on “politicians,” “oligarchs” and “regional figures who were in power for a long time and have long-term corrupt ties with local law enforcement bodies.”

“Ryaboshapka was unsuitable because he did not carry out any political demands,” he said.

In 2015, then-Vice President Joe Biden and European partners were pushing Ukraine to address corruption. They called on Ukraine’s president, Petro Poroshenko, to dismiss General Prosecutor Viktor Shokin, who was seen by Western diplomats as resisting reform. Former New York mayor Rudolph W. Giuliani, Trump’s personal lawyer, says Biden sought Shokin’s dismissal to protect Burisma and Hunter Biden.

“I don’t know what Biden said to Poroshenko,” Chumak said. “But Shokin’s firing was a very correct move for the country, not for Biden.”

Oleksandr Lemenov, founder of the civil society group State Watch, has called Ryaboshapka “the father of the anti-corruption strategy in Ukraine.” Lemenov is a member of the commission examining and interviewing prosecutors.

“For six months, Ryaboshapka refused to use the prosecutor’s office for political purposes,” Lemenov said. The main problem, he said, was Zelensky’s closeness to powerful oligarchs. Trying to complete the reforms now is “like giving birth in a third month of pregnancy.”

“It seems [Zelensky] lost his ability to see the truth,” Lemenov said. “It took nine months for Zelensky to lose our trust.”

Ryaboshapka’s efforts began at the top, in the prosecutor general’s office in Kyiv.

More than half of the prosecutors in the capital — 729 out of 1,339 — were dismissed. Among regional prosecutors, 780 of 3,161 have failed so far, before the interview stage.

“It’s the most serious reform of the prosecutor’s office in the history of Ukraine,” Chumak said. “If only we had had just half a year more, those reforms would have been irreversible.”

Venediktova said Tuesday that it was important to continue the effort. But she also expressed concern about staffing problems caused by the dismissals of so many prosecutors.

Melnichenko, the dismissed prosecutor, is now seeking work as an advocate. He says his experience — passing two computer tests but then failing interviews by humans based on “reasonable doubt” of his integrity — flips the usual legal standard of innocent until proved guilty.

“When a computer system passes you and then totally biased people fail you for some imaginary reasons and fire you, that system will be demolished in court,” he said. “Practically everyone who didn’t make it has appealed to the courts.”

He said the interviewers were supposed to be flawless individuals with unquestioned authority and integrity. But he said some had been involved in shady property deals or taking money to appear on Russian television or had been sued.

Kaleniuk, the anti-corruption activist, said the corruption cleanup was not perfect. But she saw the dismissals of Ryaboshapka, Honsharuk and others as a stunning reversal of Ukraine’s hopes for change.

Chumak had planned to fight as long as he could to continue Ryaboshapka’s reforms. On Tuesday, he posted his resignation letter to Zelensky online.

“To all those who believed in us and supported us,” he wrote, “I want to say thank you once more from our team.”

Natalie Gryvnyak contributed to this report.