THE head of the Russian military company Wagner will move to neighbouring Belarus as part of a deal to end his rebellion and the criminal case against him will be closed, the Kremlin has said.

Yevgeny Prigozhin’s troops who joined him in the uprising will not face prosecution and those who did not will be offered contracts by the Defence Ministry, Kremlin spokesman Dmitri Peskov said.

After the deal was reached, Prigozhin said he was ordering his troops to halt their march on Moscow and retreat to field camps in Ukraine, where they have been fighting alongside Russian troops.

The deal appeared to defuse a dramatically escalating crisis that represented the most significant challenge to President Vladimir Putin in his more than two decades in power.

The agreement was mediated by Belarusian president Alexander Lukashenko, a staunch ally of Putin.

READ MORE: Who are the Wagner Group and leader Yevgeny Prigozhin?

Prigozhin said that while his men are just 120 miles from Moscow, he decided to turn them back to avoid “shedding Russian blood”.

He did not say whether the Kremlin had responded to his demand to oust Defence Minister Sergei Shoigu.

The announcement follows a statement from the office of Belarusian president Alexander Lukashenko saying that he had negotiated a deal with Prigozhin after previously discussing the issue with Putin.

Prigozhin has accepted Lukashenko’s offer to halt the Wagner group’s advance and further steps to de-escalate the tensions, Lukashenko’s office said, adding that the proposed settlement contains security guarantees for Wagner troops.

In a televised speech to the nation, Putin called the rebellion a “betrayal” and “treason”.

“All those who prepared the rebellion will suffer inevitable punishment,” Putin said. “The armed forces and other government agencies have received the necessary orders.”

Authorities declared a “counter-terrorist regime” in the capital and its surrounding region, enhancing security and restricting some movement.

On the southern outskirts, troops erected checkpoints, arranged sandbags and set up machine guns.

Moscow mayor Sergei Sobyanin warned that traffic could be restricted in parts of the capital. He declared Monday a non-working day for most residents.

Crews dug up sections of highways to slow the movement of the Wagner mercenary army. Access to Red Square was closed, two major museums were evacuated and a park was shut.

Prigozhin’s private army appeared to control the military headquarters in Rostov-on-Don, a city 660 miles south of Moscow that runs Russian operations in Ukraine, the UK’s Ministry of Defence said.

Wagner troops and equipment were also in Lipetsk province, about 225 miles south of Moscow, where authorities “are taking all necessary measures to ensure the safety of the population”, said regional governor Igor Artamonov, via Telegram.

The dramatic developments came exactly 16 months after Russia launched its full-scale invasion of Ukraine that has killed tens of thousands, displaced millions and reduced cities to rubble.

Ukrainians hoped the Russian infighting would create opportunities for its army to take back territory seized by Russian forces.

Ukrainian president Volodymyr Zelensky said Moscow was suffering “full-scale weakness” and that Kyiv was protecting Europe from “the spread of Russian evil and chaos”.

The Federal Security Service, or FSB, called for Prigozhin’s arrest on Friday night after he declared the armed rebellion.

Prigozhin had said his fighters would not surrender, as “we do not want the country to live on in corruption, deceit and bureaucracy”.

“Regarding the betrayal of the motherland, the president was deeply mistaken. We are patriots of our homeland,” he said in an audio message on his Telegram channel.

Prigozhin’s private army has been fighting alongside regular Russian troops in Ukraine. His goals were not immediately clear but the rebellion marked an escalation in his struggle with Russian military leaders, whom he accused of botching the war in Ukraine and hobbling his forces in the field.

READ MORE: Vladimir Putin faces armed rebellion from Wagner group

“This is not a military coup, but a march of justice,” Prigozhin said.

He said he had 25,000 troops under his command and urged the army not to offer resistance.

He posted video of himself at the military headquarters in Rostov-on-Don and claimed his forces had taken control of the airfield and other military facilities in the city. Other videos on social media showed military vehicles, including tanks, on the streets.

“We didn’t kill a single person on our way,” Prigozhin said in one of his several messages posted as the day went on, adding that his forces seized the military headquarters “without a single gunshot”.

The rebellion comes as Russia is “fighting the toughest battle for its future”, Putin said, with the West piling sanctions on Moscow and arming Ukraine.

“The entire military, economic and information machine of the West is waged against us,” Putin said.

A Muscovite who gave only his first name of Khachik called the situation “scary”.

State-controlled TV networks led their news broadcasts with Putin’s statement and reported the tense situation in Rostov-on-Don. Some showed social media videos of residents denouncing Wagner troops.

Broadcasters also carried statements from top officials and lawmakers voicing support for Putin and condemning Prigozhin.

In announcing the rebellion, Prigozhin said he wanted to punish Defence Minister Sergei Shoigu after he accused Russian government forces of attacking Wagner field camps in Ukraine with rockets, helicopter gunships and artillery.

He claimed that “a huge number of our comrades got killed”.

Prigozhin said his forces shot down a Russian military helicopter that fired on a civilian convoy.

He alleged that General Valery Gerasimov, chief of the General Staff, ordered the attacks following a meeting with Shoigu, where they decided to destroy the military contractor.

The Defence Ministry denied attacking the Wagner camps.

Prigozhin, 62, a former convict, has long ties to the Russian leader and won lucrative Kremlin catering contracts that earned him the nickname “Putin’s chef”.

He gained attention in the US when he and a dozen other Russian nationals were charged with operating a covert social media campaign aimed at fomenting discord ahead of Donald Trump’s 2016 presidential election victory.

He formed the Wagner mercenary group, which sent military contractors to Libya, Syria, several African countries and eventually Ukraine.

After Putin’s address, in which he called for unity, officials sought to reiterate their allegiance to the Kremlin and urged Prigozhin to back down.

Vyacheslav Volodin, speaker of the lower house of parliament, said lawmakers “stand for the consolidation of forces″ and support Putin.

Foreign Ministry spokeswoman Maria Zakharova echoed that, saying in a Telegram post that “we have one commander in chief. Not two, not three. One″.

Ramzan Kadyrov, the strongman leader of the Chechnya region who used to side with Prigozhin in his criticism of the military, also expressed his full support of Putin’s “every word”.

“The mutiny needs to be suppressed,” Kadyrov said.