A year ago, a dozen Nigerian troops fighting about 200 Boko Haram militants in the town of Chibok exhausted their ammunition and ran, leaving the road open for the abduction of nearly 300 girls.

Today, Nigerian soldiers are rescuing hundreds of kidnapped girls and women from the last forest stronghold of the Islamic insurgents.

The reason for the unimaginably swift shift in fortunes?

In the last three months, military forces from neighboring Chad, Niger and Cameroon have joined the battle. In addition, Nigerian troops are finally receiving better arms and weapons, as well as hazard pay that they had not received until this year.

As a result, Boko Haram's supply lines are being cut off, creating conditions for the security forces to deliver a potential knockout blow to the extremists who have created havoc in northeastern Nigeria for years.

Nigeria's military has announced that it has recaptured all major towns seized by the insurgents and that Boko Haram's main fighting force is hemmed into the Sambisa Forest, where it is being pounded by air raids and attack helicopters. While the government forces are stronger, Boko Haram is growing weaker by the day.

Women rescued in recent days from forest camps said that now it is the insurgents who are running out of ammunition, along with food and fuel. That could explain why — when the captives refused to follow fleeing Boko Haram members last week — the militants did not shoot them. Instead, they stoned the girls and women, killing several of them.

Last year, Boko Haram fighters were able to escape across Nigeria's borders to evade capture. Now, they are blocked by the troops from Chad, Niger and Cameroon. With Nigeria's permission, Chad and Niger have even sent their forces inside Nigeria to pursue the extremists.

Routes used by Boko Haram to transport fuel and ammunition have been reclaimed by the military. On Sunday, military intelligence officers arrested a man who allegedly supplied fuel and food to Boko Haram, reported Defense Ministry spokesman Maj. Gen. Chris Olukolade.

Last year's toll of people killed by Boko Haram was estimated at 10,000 — more than in all the previous four years of the insurgency combined. The group carried out cross-border attacks with impunity, seized a swath of northeastern Nigeria the size of Belgium and created a wave of 1.5 million refugees fleeing the self-declared Islamic caliphate.

President Goodluck Jonathan did not take a strong stand until this year — too late to save him from losing re-election in March as disgusted voters in Africa's biggest democracy opted instead for Muhammadu Buhari, a former military dictator.

Jonathan also was slow to act when the group last year abducted the more than 200 schoolgirls in Chibok — initially denying it had even happened and losing precious weeks in the mass kidnapping that sparked worldwide outrage and a campaign for their freedom under the hashtag of #BringBackOurGirls. It is still unclear if any of the Chibok girls are among the 700 freed from Boko Haram in the past week.

Buhari had crushed another Islamic uprising in the 1980s, and he has vowed "to rid this nation of terror" after he becomes president on May 29. A retired major general, he describes himself as a convert to democracy, and showed it by taking power through the ballot box.

In the war zone, self-defense civilian groups patrol markets with homemade weapons, looking out for suicide bombers — but also for strangers buying large amounts of food, indicating they could be Boko Haram members or suppliers. While the group still has the ability to carry out bombings and isolated attacks, it would be difficult for it to surpass last year's carnage.

Nigeria and its African partners say they want to eradicate Boko Haram. A more realistic goal may be to reduce it to what it used to be: a terror group with no control over territory — still able to launch attacks but not on as large a scale as before.

Soldiers on the battlefront around the hills and caves of Gwoza, which Boko Haram had declared the capital of its caliphate, told The Associated Press this week that many improvements have led to the turnaround against the insurgents. Among them:

— Troops this year began receiving the daily hazard pay of 15,000 naira ($75) for the first time.

— Some battle-weary troops who had been on the front lines for two years recently have been allowed to stand down.

— The forces have received new weapons and ammunition. Previously, there were reports that troops going into battle had only 30 rounds of ammunition each, with corrupt commanders diverting resources into their own pockets.

Since democracy was restored in Nigeria in 1999, civilian governments have deliberately kept the armed forces weak to ensure that soldiers could not mount any more of the coups that kept the West African nation subjected to military dictatorships for decades. Boko Haram has forced a change in that strategy.

Africa's biggest oil producer has bought helicopters, drones, armored personnel carriers, tanks, rocket launchers and other armaments. This includes helicopter gunships that are being used in the Sambisa Forest to scatter the militants and drive them away from their captives, according to video released Monday by PR Nigeria, an agency that disseminates government information.

"What we never had, we now have," the government spokesman on the insurgency, Mike Omeri, told the AP in a recent interview. "We have drones, we have aircraft, we have APCs, and so on, and we are getting to where we should be to rebuild the armed forces, returning it to its glory."

Buhari will be tested on whether he can revive the economy in the northeast, which has been decimated by the uprising. Hundreds of thousands of farmers have been driven from their lands, some of the biggest cattle markets on the continent no longer exist and many investors have abandoned the region. Rebuilding the hundreds of thousands of structures razed by Boko Haram will cost many millions of dollars.

The stakes are high for landlocked Chad as well, since many of its trading routes have been closed by the insurgency.

Economic strife has been one of the root causes for the rise of Boko Haram, which has exploited the feelings of exclusion among the unemployed and disaffected men in predominantly Muslim northern Nigeria.

Buhari also has promised to address corruption, another reason for the group's growth. Corruption sapped the military of its strength and has deprived front-line troops of weapons and vehicles. Unless Buhari can root it out, it will affect the military's capability to prevent the rise of another group like Boko Haram.

___

Associated Press writer Ibrahim Abdulaziz contributed to this report from Yola, Nigeria.