The president of South Sudan said on Monday he had defeated a coup attempt following a night of fierce fighting in the capital of the newly-independent nation. The clashes broke out in a barracks close to the city centre shortly before midnight and spread across the city, diplomats and witnesses said, adding that heavy machine guns and mortars were used. The UN said hundreds of terrified civilians had sought refuge in a United Nation compound, while across the city most residents locked themselves in their homes. “This was an attempted coup,” President Salva Kiir said, blaming his arch-rival – former vice president Riek Machar who was sacked from the government in July – for starting the violence. “Your government is in full control of the security situation in Juba. The attackers fled and your forces are pursuing them. I promise you justice will prevail,” the president said in a speech. “I will not allow or tolerate such incidents once again in our new nation. I strongly condemn these criminal actions in the strongest terms possible,” he added. He said an overnight curfew would be imposed from 6pm on Monday to 6am on Tuesday, and remain in force until further notice. Army spokesman Phil Aguer also told local radio that troops loyal to the president were “in control of the situation”. Officials said some arrests had been made, but the fate of Machar was unclear. There was also no word on casualties from the fighting. Statements from the US and British embassies in Juba urged their nationals to avoid unnecessary movements. The US embassy said there hade been “incidents and sporadic gunfire in multiple locations across Juba” throughout the night. A diplomat in the city said troops loyal to the president had been posted at major intersections. Civil aviation and airline sources also said that Juba airport had been shut indefinitely, while the country’s borders with Uganda and Kenya were reportedly shut. Machar leads a dissident group within South Sudan’s ruling party – the Sudan People’s Liberation Movement (SPLM) – and is seen as the main challenger to Kiir. Oil-rich but impoverished South Sudan won its independence in 2011 after its people voted overwhelmingly in a referendum to split from the north and form a new nation. Political tensions have worsened in recent weeks, and earlier this month key SPLM leaders – including Machar and Rebecca Garang, the widow of South Sudan’s founding father John Garang – made a public challenge to President Kiir, accusing him of being dictatorial. The United Nations said it was “deeply concerned” over the fighting and that it was in contact with South Sudan’s leadership. “As the Special Representative of the Secretary General I urge all parties in the fighting to cease hostilities immediately and exercise restraint,” UN Special Representative Hilde Johnson said in a statement. “I have been in touch regularly with the key leaders, including at the highest levels to call for calm,” she added. A spokesman for the UN mission in South Sudan, UNMISS, said hundreds of civilians had sought shelter at a UN compound. “We have more than 800 civilians who came into our compound adjacent to the airport, mostly women and children. Among them are seven wounded, including a two-year-old boy in a critical condition,” Joseph Contreras said.