Fighting has resumed in South Sudan after rebel forces attacked a key oil town in the state of Upper Nile, a South Sudanese military official said.

A government official confirmed that the rebels have reached the town and could have taken over more than half of Malakal.

The UN says there is heavy fighting around the UNMISS compound which is next to the airport and crossfire is landing in the compound.

South Sudanese military spokesman Philip Aguer told the Associated Press news agency that fighting broke out early on Tuesday in Malakal, which once was in rebel hands but is now controlled by government troops.

"The fighting is very heavy. There is fighting on the outskirts of the town. It's a very big coordinated attack," a witness told the AFP news agency.

Although the country's warring factions signed a ceasefire on January 23, both sides have repeatedly accused each other of violating that agreement.

Toby Lanzer, the United Nation's top humanitarian official in South Sudan, tweeted on Tuesday that all groups "engaged in the violence must uphold people's rights and protect non-combatants''.

The UN said both sides had committed rights violations, and on Monday South Sudan's military announced that more than 20 government soldiers had been charged over civilian killings.

UN compound surrounded

Grace Cahill, a spokeswoman for Oxfam in South Sudan, said armed groups had gathered outside the UN compound in Malakal, where 27,000 people were seeking shelter.

"The presence of armed groups outside the compound has made those inside very scared,'' she said.

Thousands of people have been killed and more than 800,000 displaced by violence since mid-December, when a fight broke out among presidential guards in the capital, Juba, before spreading out across the country.

Ugandan forces are fighting alongside the South Sudanese military as it tries to stop a rebellion led by former Vice President Riek Machar, an influential politician whose dismissal last year sparked ethnic tension in a country with a history of divided military loyalties.

Machar is Nuer, the ethnic group of most of the soldiers who defected and joined his rebellion late last year.

Most of the loyalist forces are from the Dinka ethnic group of President Salva Kiir, whose government insists that unrest in the country was sparked by a failed military coup mounted by soldiers loyal to Machar.

Machar denies the coup allegation but says his goal is to have Kiir removed from power.