PARIS (AP) — An unpopular leader entangled in an unpopular war that he once staunchly defended, President Nicolas Sarkozy is suddenly considering a pullout of French troops from Afghanistan as another kind of campaign approaches: For his own re-election.

The killing Friday of four French troops by one of their Afghan trainees upended Sarkozy’s counterterrorism strategy, leading him to immediately suspend France’s training program and joint military patrols and raise the prospect of an accelerated pullout from Afghanistan.

Afghanistan is not at the center of France’s presidential race, which culminates in a two-round vote in April and May. But for Sarkozy, the war looms as uncomfortable background noise amid wider French public concerns about swelling state debts and joblessness at its highest in over a decade.

On Afghanistan, he’s been on the defensive: Francois Hollande, the Socialist nominee for the presidential election, wants a pullout soon — a position supported by most French, according to polls.

Sarkozy has not formally announced whether he will run, but nearly all political observers expect he will. Polls show him trailing Hollande, and he has widely been seen as battling on all fronts to boost his lagging popularity.

A brash and impulsive leader, Sarkozy has had several successes in the international arena — notably with French interventions in countries like Libya and Ivory Coast. But he has struggled to parlay them into political capital at a time when pocketbook issues are on the minds of most French.

Sarkozy, who took office in 2007, inherited France’s participation in Afghanistan long after it began with the international coalition a decade ago, but repeatedly invoked it as important to helping keep France safe.

Time after time, as French soldiers fell in combat on Afghan land — including 26 last year alone — Sarkozy insisted France wouldn’t walk away from the fight. He pegged the eventual French withdrawal from Afghanistan to President Barack Obama’s planned pullout timetable for U.S. troops of 2014.

After Friday’s shootings, France may now break ranks on that.

Speaking to French diplomats Friday, Sarkozy said that if security conditions for the country’s troops in Afghanistan cannot be restored, “then the question of an early withdrawal of the French army would arise.”

He said French troops were in Afghanistan to help Afghans fight terrorism and the Taliban, and “The French army is not in Afghanistan so that Afghan soldiers can shoot at them.”

The killings — one of the deadliest single days for French troops in Afghanistan — was the second time in a month that they’d been killed by Afghan soldiers. It revived concerns of an increased Taliban infiltration of the Afghan police and army.

The killings led Sarkozy to quickly rethink his Afghan policy.

“My hunch is that he was reeling from the blow,” said Heisbourg, who heads the Foundation for Strategic Research think tank in Paris. “It’s not only four soldiers killed, a large number of guys were wounded. The whole ’business model’ is being upset — if we were talking in business terms.”

Sarkozy, who prides himself as a man of action, immediately ordered his defense minister and military chief of staff to Afghanistan to investigate the killings and wounding of 15 other French troops — eight of them seriously.

France’s foreign minister sought to give his boss some political cover.

“In the face of such moving tragedies like the one we are experiencing today ... considerations about how it counts or not in the electoral campaign don’t cross our minds,” Alain Juppe told reporters.

The U.S. has praised France’s role in Afghanistan — Paris provides the fourth-largest contingent to the campaign. Many pundits said Obama, who is wildly popular in France, did Sarkozy a favor by appearing in a joint French TV interview after the G-20 summit in November and praising France’s military roles in Libya, within the NATO structure, and Afghanistan.

Sarkozy, an unapologetic, longtime admirer of the U.S., said then: “when the Americans had troubles in Afghanistan, we needed to be at their sides — because if not, we’re not friends, we’re not allies.”

In Washington, White House spokesman Jay Carney called France “an excellent and valued member” in the NATO-led mission in Afghanistan, but declined to address possible French decisions about their future role there.

Hollande, the Socialist nominee, wasted little time taking to French airwaves to reiterate his line on Afghanistan: That France has done its job, and needs to bring its troops home by year-end.

“It’s time — more than time — to start our withdrawal that will be seen not as abandoning a mission launched in 2001, but an end to an intervention that has today reached its goal and has no reason to be extended,” Hollande said. He pledged to coordinate a French pullout with NATO allies and Afghan authorities.

Earlier in the Afghan campaign, as the administration of U.S. President George W. Bush focused on using hard power to crush the Taliban and their al-Qaida allies, France took a different tack. It advocated a NATO focus on training for Afghan soldiers and police, and building up civil society.

Under Sarkozy, France reached its peak deployment in Afghanistan in 2010 — about 4,000 troops. France has lost 82 soldiers in the country since 2001, more than one-third of them last year alone.

The main French role in the NATO mission has been to help ensure security in an area northeast of Kabul, the capital. About 3,600 French troops now take part in the NATO-led operations, down about 10 percent from late last year in sync with a gradual U.S. drawdown.