A military unit tried to seize the presidential palace in Niger’s capital Niamey overnight in an attempted coup but order has been restored, the government said on Wednesday, days before the country’s first democratic handover of power.

The assailants, from a nearby air base, fled after the presidential guard met their attack with heavy shelling and gunfire, three security sources said, requesting anonymity because they were not authorised to speak to media.

Government spokesman Abdourahamane Zakaria said several people had been arrested while others were still being sought, but that the situation was under control.

“The government condemns this cowardly and retrogressive act that aims to endanger democracy and the rule of law to which our country is resolutely committed,” he told a news conference.

Assuring people they could go about their daily lives, he said: “The government congratulates the presidential guard and the other defense and security forces for their prompt reaction, a testament of their loyalty to the republic.” He did not take questions.

President Mahamadou Issoufou is stepping down after two five-year terms and president-elect Mohamed Bazoum, the ruling party candidate, is due to be sworn in on Friday after an election victory disputed by his opponent Mahamane Ousmane.

Former U.S. Sahel envoy J. Peter Pham earlier tweeted that both the president and president-elect were safe, and the president’s office shared photos on Twitter of Issoufou presiding over the swearing-in ceremony for two top judges.