South Sudan's President Salva Kiir says an attempted coup by soldiers loyal to his former deputy Riek Machar has been put down.
Mr Kiir said the government was in full control of the capital, Juba, after a night of heavy fighting between soldiers in the presidential guard.
A night time curfew has been put in place and a number of arrests have reportedly been made.
Several people were reported injured and hundreds have fled to a US base.
Hilde Johnson, the UN's special representative in the country, said she was "deeply concerned" and urged "all parties in the fighting to cease hostilities immediately and exercise restraint".
"I have been in touch regularly with the key leaders, including at the highest levels to call for calm," she said.
The fighting in Juba broke out overnight, and intensified in the early morning, with reports of continuous gunfire and several explosions.
The city's airport has been closed and the state TV channel SSTV went off air for several hours.
Shortly after it came back on air, SSTV broadcast an address from Mr Kiir, wearing military uniform rather than his usual civilian clothing and flanked by government officials.
He said the violence "was an attempted coup", but that the government was now in full control and the attackers were being chased down.
He said the fighting began when unidentified uniformed personnel opened fire at a meeting of SPLM, followed by an attack on army headquarters near the university carried out "by a group of soldiers allied to the former vice-president Dr Riek Machar and his group".
"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 said, vowing those responsible would be have to stand "before the appropriate law institution".
The ruling party, former rebel force the Sudan People's Liberation Movement (SPLM), would never allow power to be transferred by force, he said.
He announced a curfew would be in place every night between 18:00 and 06:00, beginning on Monday.
"Rest assured that the government is doing all it can to make sure that citizens are secured and safe."
Foreign Minister Barnaba Marial Benjamin told the Associated Press that some soldiers had tried to raid the weapons store at the main military based in the capital, but were repulsed.
He said some politicians had since been arrested.
Mr Riek has not commented and his whereabouts are unclear. But his spokesman said he was safe and denied reports he had been arrested.
South Sudan - the world's youngest country and one of the least developed - has struggled to achieve a stable government since becoming independent from Sudan in 2011. The independence referendum was intended to end a decades-long conflict, led by the SPLM, against the north.
The oil-rich country is ethnically and politically divided, with many armed groups active. Tensions have been particularly high since President Kiir dismissed his entire cabinet, including Mr Machar, in July.
The sackings are believed to have followed a power struggle - Mr Machar has said he plans to contest the presidential elections in 2015. He now leads a dissident faction within the SPLM.
The two men are from rival ethnic groups that have clashed in the past. Mr Kiir is from the Dinka community, the largest in South Sudan, while Mr Machar is from the Nuer, the second-largest. Some Nuer have complained about Dinka political domination.
Juba was reportedly calm by mid-morning with few civilians on the streets, but heavily armed troops were seen patrolling.
Hundreds of people, mainly women and children, have taken shelter at the UN compound near the airport and at a UN house in the city.
A spokesman told Reuters seven people, including a two-year-old boy, had been treated for gunshot wound.
The UN said in a statement: "We hope the security situation in Juba will quickly normalise to enable the civilians to return very soon to their residential areas. To that end, UNMISS (the UN mission in South Sudan) calls on all parties to show continued calm and restraint."
The UN and the US embassy advised their citizens to stay at home. Both denied rumours they were harbouring any political or military figures.