Three US military aircraft attempting to evacuate American citizens from a remote region of South Sudan came under fire as gun battles raged between the country's military and rebel militia. Four US service personnel were wounded in the attack.

The aircraft were hit on Saturday while preparing to land in Bor, the capital of Jonglei state – scene of some of the nation's worst violence over the past week. A South Sudan official said violence against civilians there had resulted in bodies "sprinkled all over town".

The US military said three CV-22 Ospreys – aircraft that can fly like a helicopter and aeroplane – were "participating in a mission to evacuate American citizens in Bor". Gunfire had downed a UN helicopter in the state the day before. Following the attack, the US aircraft were diverted to Entebbe, Uganda, and the mission aborted. The injured personnel were flown to Nairobi, Kenya, on board a US air force C-17 transport plane for medical treatment, according to a military statement.

An official in the region, who insisted on anonymity, said the US military had not informed the rebel commander in Bor – General Peter Gadet, who defected from the South Sudan military this week – that they intended to land, which may have led to the attack. US statements said the gunfire came from unknown forces.

Colonel Philip Aguer, South Sudan's military spokesman, said government troops were no longer in control of Bor, so the attack on the US aircraft should be blamed on rebel soldiers.

"Bor is under the control of the forces of Riek Machar," Aguer said, referring to South Sudan's ousted vice-president.

The US embassy in Juba has evacuated at least 450 expatriates from the city this week and had hoped to begin evacuations from Bor. The UN sent four helicopters on Friday to extract 40 peacekeepers from a base in Yuai, also in Jonglei, a UN information officer, Joe Contreras, said. One helicopter was fired upon and made an emergency landing in Upper Nile state, he said. There were no casualties.

South Sudan's information minister, Michael Makuei Lueth, said South Sudanese ground troops, backed by the country's air force, were fighting rebels in Bor in an effort to retake the state capital.

"There is fighting going on in Bor town, yes, because since morning they have continued to attack the civilian population," he said.

South Sudan's president, Salva Kiir, an ethnic Dinka, said this week that an attempted coup triggered this week's clashes, blaming Machar, an ethnic Nuer. Officials have since attributed the recent conflict to Dinka and Nuer members of the presidential guard. Hundreds have died in the violence, which the UN security council said on Friday could spread across the border and affect the entire region.

Speaking in Manila on Sunday, the UN secretary general, Ban Ki-moon, urged South Sudan's leaders "to do everything in their power to ensure that their followers hear the message loud and clear that continued violence, ethnic and otherwise, is completely unacceptable and pose a dangerous threat to the future of their country".

Kenya announced it was sending troops to evacuate 1,600 Kenyans stranded in South Sudan, many of them in Bor. Earlier this week, President Barack Obama dispatched American troops to help protect the US embassy in Juba. The US, Britain, Germany and Italy have all assisted their citizens in evacuating the country.

The south fought a decades-long war with Sudan before a peace deal in 2005 resulted in a referendum two years ago that led to South Sudan breaking away from the north and taking most of the region's oil wealth with it.

An International Crisis Group expert on South Sudan told the Associated Press on Friday that rebels had taken control of at least some of South Sudan's oilfields, an issue that could bring Sudan into the conflict. South Sudan's oil flows north through Sudan's pipelines, providing Khartoum with much-needed income.