In July, South Sudan celebrated its second year of independence.

Just five months later, analysts warned the country could be sliding toward civil war. Violence began to spread from the capital of Juba.

"The scenario many feared but dared not contemplate looks frighteningly possible: South Sudan, the world's newest state, is now arguably on the cusp of a civil war," said a report from International Crisis Group.

"Violence has spread beyond the capital, including to areas already fraught with ethnic tensions, principally Jonglei state, over which the government may have lost control," the report noted.

The most recent violence has claimed about 500 lives since Sunday, and the United States and Britain have evacuated their personnel from the country. About 20,000 people have fled their homes, seeking shelter at UN peacekeeping bases.

As of Thursday, the government had lost control of the town of Bor. US President Barack Obama said, "South Sudan stands at the precipice."

Choul Laam, the chief of staff for the ruling Sudan People's Liberation Movement's secretary general, said, "The situation in South Sudan can be best described as tense and fragile. If it is not contained it could lead to ethnic cleansing."

So what led South Sudan down this road?

First, the main players

South Sudan's President Salva Kiir. (AFP/Getty Images)

Salva Kiir, South Sudan's first president after independence, accused his rival and former deputy Riek Machar of attempting a coup after violence broke out Sunday. Kiir had fired Machar from his post in July, when he also dismissed 28 cabinet ministers, throwing the country into political turmoil.

Kiir, who hails from the Dinka community, fought for South Sudan's independence as part of the SPLM. Though there were allegations of vote rigging in elections held before South Sudan achieved independence, Kiir won by a wide margin.

His allies noted that Kiir was intolerant of dissent.

That didn't bode well for Riek Machar. In a televised address on Monday, Kiir blamed Sunday's clashes on Machar attempting a coup, calling him a "prophet of doom" who continued to "persistently pursue his actions of the past."

South Sudan's former Vice President Riek Machar. (AFP/Getty Images)

Machar denied Kiir's allegations of a coup, describing what took place as a "misunderstanding between presidential guards within their division," to the Paris-based Sudan Tribune.

"It was not a coup," Machar said, adding, "Kiir wanted to use the alleged coup attempt in order to get rid of us."

Machar is not only a hero of South Sudan's struggle for independence. He's also Kiir's rival for the leadership of the SPLM, and belongs to the secong largest ethnic group in the country, the Nuer.

When Machar was dismissed in July, he publicly criticized Kiir's leadership and declared he would run for president in 2015.

"The point is, he [Machar] wants to lead the SPLM. In a sense, he’s fighting for leadership," said Cedric Barnes, the International Crisis Group's Horn of Africa project director.

Machar was certainly candid about that when he told Radio France Internationale, "We want him to leave. We want him to leave. That's it. He can't unite the people and he kills them like flies."

Ethnic tensions

A woman from the Dinka tribe in Juba, South Sudan. (AFP/Getty Images)

The conflict goes well beyond those two, however. The United Nations says the unrest could lead to a civil war along ethnic lines between the Nuer and the Dinka.

The ICG report noted that armed groups appeared to have "targeted civilians based on ethnicity."

New York-based Human Rights Watch said it received reports that ethnic Dinka might have been targeted by Nuer soldiers in the capital Juba and the town of Bor (in the state of Jonglei).

It wouldn't be the first time there was ethnic conflict in Bor. In 1991, Nuer soldiers loyal to Machar massacred hundreds of Dinkas in the town of Bor, in the state of Jonglei.

The think tank Eurasia Group noted that Machar's dismissal alienated the "long aggrieved Nuer" in South Sudan, which has a "factionalized military and a history of violent ethnic rivalries."

The BBC also noted that tensions within the SPLM might reflect resentment against a perceived Dinka majority in government, citing South Sudan observers.

ICG's Barnes said the violence shouldn't be viewed purely along ethnic lines, however.

"Many Dinkas are being arrested as well. The Dinkas are not unified and there is no strong solidarity within the SPLM politicians."

"It’s being manipulated by all sides and people are instrumentalising ethnic identity to achieve political ends."