NAIROBI, Kenya — Amid signs that a cease-fire agreement could be close, the government of South Sudan said Saturday that it had won a significant military victory, recapturing the strategic town of Bor from rebel forces.

Bor, the capital of Jonglei State, has been the scene of some of the fiercest fighting in the monthlong conflict, trading hands between rebel and government forces several times.

“Our forces have recaptured Bor from the rebels,” said Michael Makuei Lueth, South Sudan’s information minister. “They are now on the run.”

Troops from the Uganda People’s Defense Force played an important role in the offensive in Bor, according to an army spokesman. “Our troops have overpowered the rebels and taken over the entire city of Bor,” said the spokesman, Lt. Col. Paddy Ankunda.

Uganda had long denied taking part in combat operations in neighboring South Sudan, but President Yoweri Museveni said Wednesday that his soldiers were fighting alongside troops loyal to the South Sudanese president, Salva Kiir, against forces aligned with his ousted rival, former Vice President Riek Machar.

There were signs that negotiators in the Ethiopian capital, Addis Ababa, were getting closer to a deal to suspend hostilities. “It’s an agreement that can create an environment that gives peace to the two sides to negotiate on political issues,” said Yohanis Musa Pouk, a spokesman for the rebels in Addis Ababa.

He said that the proposed deal would not solve the issues between the sides, but would “allow the humanitarians to reach the affected areas” and provide aid.

A presidential spokesman told reporters in Juba, South Sudan’s capital, that the government was ready to sign a cease-fire agreement. Mr. Lueth, the information minister, said that he expected one to be signed soon, while denying news media reports that it could be agreed to as soon as Saturday.

The two sides have had difficulty reaching an agreement, particularly on the question of supporters of Mr. Machar who were arrested after what Mr. Kiir called an attempted coup. The rebels have denied that there was a plot and demanded the release of the detainees as a precondition for a cease-fire.

It took days just to get the two sides talking face-to-face after both groups had arrived in Addis Ababa. And questions remain as to whether the fighters in far-flung corners of South Sudan will lay down their weapons just because politicians declare a cessation of hostilities.

Thousands of people have been killed and more than half a million displaced since the fighting began in December, with 84,000 fleeing across the borders to Uganda, Ethiopia, Sudan and Kenya. Aid groups say there is a desperate need for food, medicine and shelter, particularly for those in areas still affected by the fighting.

A top United Nations human rights official said Friday that both sides in the conflict had committed “mass atrocities.” The official, Ivan Simonovic, the assistant secretary general for human rights, described bodies on the streets of Bentiu and reports of mass killings, sexual violence and the recruitment of children into battle.

The two sides have been in Addis Ababa for more than two weeks. Negotiations have proceeded slowly despite intense international pressure for a cessation of hostilities.

“Of course we are optimistic that they will sign the cease-fire, there is no doubt about that,” Mr. Lueth said, “but as to when will depend on how the rebels conduct themselves.”