NAIROBI (Reuters) - South Sudan’s government said on Friday it had taken the last town before the main rebel base of Pagak, where thousands of civilians have fled to escape fighting near the border with Ethiopia.

Mai-wut had been under rebel control since the beginning of the war in late 2013 and is a gateway to the main rebel stronghold of Pagak, which if taken by the government would weaken the rebellion led by former vice president Riek Machar.

In a separate blow to Machar, a senior commander allied to the rebel leader’s SPLM-IO group said on Friday he had left to join up with a separate rebel faction, led by General Thomas Cirillo, the most senior officer to defect from President Salva Kiir’s army in the last year.

Mai-wut sits along a supply route from Ethiopia to another town, Mathiang, which is adjacent to the Paloch oilfields, the main source of government revenue.

Dickson Gatluak Jock, a spokesman for the forces of South Sudan’s First Vice President Taban Deng Gai, who were involved in the fighting, said three government soldiers were killed and five others wounded in capturing Mai-wut.

Jock said they entered the town on Thursday morning after clashing with rebel forces.

“It is under our control. Our forces managed to reach the town around 10 a.m.,” he said.

Up to 7000 families have fled to Pagak to escape the fighting since the government launched its offensive earlier this month, said Sarah Nyanath, head of GESSO, a local aid group in the town.

South Sudan descended into civil war in 2013 after Kiir fired Machar as his deputy, unleashing a conflict that has spawned armed factions often following ethnic lines.

Last July, Deng Gai, a former chief opposition negotiator, broke ranks with Machar and joined Kiir with troops allied to him.

Jock said on Friday that Deng Gai’s forces at Mai-wut were backed by army troops from Paloch and were forced to attack the rebels after they hit government positions near Mai-wut.

A spokesman for the SPLM-IO rebels confirmed the town was no longer under their control.

Machar was further weakened when John Kenyi Loburon, the commander of his forces in South Sudan’s Central Equatoria state, which has seen some of the worst fighting in the last year, said he had joined General Cirillo’s National Salvation Front rebel group.

He said in a statement that he left because the movement had splintered between Machar and Deng Gai and because Loburon’s troops had been sidelined by the top leadership.

Cirillo, who lives in Ethiopia, says his aim is to overthrow Kiir, accusing him of running a tribalist army and government.

The fighting in South Sudan has forced millions to flee their homes, split much of the population along ethnic lines, paralysed agriculture and cut oil production.