The second half of 2007 saw violence drop dramatically in Iraq, but the progress came at a high price: The year was the deadliest for the U.S. military since the 2003 invasion, with 899 troops killed.
American commanders and diplomats, however, say the battlefield gains against insurgents such as al Qaeda in Iraq offer only a partial picture of where the country stands as the war moves toward its five-year mark in March.
Two critical shifts that boosted U.S.-led forces in 2007 - a self-imposed cease-fire by a main Shiite militia and a grassroots Sunni revolt against extremists - could still unravel unless serious unity efforts are made by the Iraqi government.
Iran also remains a major wild card. U.S. officials believe the neighboring country has helped quiet Iraq by reducing its flow of suspected aid to Shiite fighters, including materials needed for deadly roadside bombs.
But Iran's apparent hands-off policies could come under strain as Shiite factions - some favoring Iran, others not - battle for control of Iraq's oil-rich south.
The Pentagon, meanwhile, will increasingly look to the uneven Iraqi security forces to carry the load in 2008 as demands for an American exit strategy grow sharper during the U.S. presidential election year.
Britain, the main U.S. coalition partner in Iraq, is gradually drawing down its forces and other allies, including Poland and Australia, are contemplating full-scale withdrawals in the coming year.
"We're focusing our energy on building on what coalition and Iraqi troopers have accomplished in 2007," Gen. David Petraeus told a group of Western journalists on Saturday. "Success will not, however, be akin to flipping on a light switch. It will emerge slowly and fitfully, with reverses as well as advances, accumulating fewer bad days and gradually more good days."
That arc of progress played out in the raw statistics of U.S. and Iraqi casualties.
American military deaths peaked in May with 126 troops killed. It was then that the U.S. began ramping up its attacks against insurgent strongholds, leading to increased clashes in Baghdad and other key areas across central Iraq.
Seven months on, commanders and analysts say America's aggressive strategy of targeting al Qaeda in Iraq strongholds is paying off: U.S. casualties have dropped sharply. As of Sunday night in Baghdad, 21 deaths were reported in December, one more than in February 2004, which was the lowest monthly total of the war.
The 899 deaths in 2007 surpassed the previously highest death toll in 2004, when 850 U.S. soldiers were killed. The total for 2007 could rise slightly; occasionally the military reports new casualties a few days after they occur. The military reported the non-combat related death of a soldier on Sunday.
At least 3,902 members of the U.S. military have died since the beginning of the war. Of those, at least 3,175 died as a result of hostile action, according to the military's numbers.
Iraqi civilian deaths have tracked that decline and overall violence across the country is down roughly 60 percent, American commanders say.
Since the influx of some 30,000 U.S. troops that began in June, the lessening violence has meant that new problems have emerged.
"There certainly are ample challenges out there in the new year. In some respects, the positive developments in the latter half of 2007 also represent the challenges of 2008," U.S. Ambassador Ryan Crocker said during a recent briefing.
An example, Crocker said, is how the improving security situation is in part luring back Iraqis who took refuge in neighboring Syria, Jordan and elsewhere.
"The return of refugees - a good thing obviously, but a process is going to have to be carefully managed so that it doesn't sow the seeds of new tension and instability," he said.
Along with the increase in American troops, Iraq's lessening violence has been attributed to a self-imposed freeze on activities by the Mahdi Army - the militia of radical Shiite cleric Muqtada al-Sadr.
Another important change was the quick growth of mostly Sunni anti-al Qaeda in Iraq groups, or "awakening councils," who once fought against U.S. and Iraqi forces but now point their guns toward the insurgents.
Of the more than 70,000 fighters in the awakening councils, only 20 percent are expected to be absorbed into the Iraqi security forces. The rest are to receive job training through a joint $300 million (euro204 million) program Iraqi and American officials are creating.
That program is in its beginning stages and there are few details about how it will be carried out, but analysts say it must succeed or the Sunni fighters who do not join Iraq's military may sell their services to the insurgents.
On Saturday, a new audiotape by Osama bin Laden warned Iraqi Sunnis against fighting al Qaeda, saying "the most evil of the traitors are those who trade away their religion for the sake of their mortal life."
Keeping the militia of al-Sadr and other powerful Shiite leaders on the sidelines also means keeping Iran to its promise to halt the flow of weapons and training to them, officials say.
"How lasting a phenomenon that will be and how Iran will define and play its role in Iraq in 2008 I think is going to be very important to the long-term future of the country," Crocker said.
Iraqi civilian deaths also peaked in May with 2,155 killed. That fell to 718 in November and 710 in December. For the year, 18,610 Iraqis were killed. In 2006, the only other full year an AP count has been tallied, 13,813 civilians were killed.
Civilian deaths are compiled by the AP from hospital, police and military officials, as well as accounts from reporters and photographers. Insurgent deaths were not included. Other counts differ and some have given higher civilian death tolls.
Those numbers paint an increasingly optimistic picture, but James Carafano, a security expert with the Heritage Foundation think-tank in Washington, D.C., warned dangers lurk.
"The number of people who have the power to turns things around appears to be dwindling," he said regarding extremists. "But there are still people in Iraq that could string together a week of really bad days."
While that might not mean a return to the bloodiest moments of the Iraq war, Carafano said it could seriously rattle the Iraqi government as it tries to bring about some form of political reconciliation in 2008, a key to long-term security.
"People have to be really careful about over-promising that this is an irreversible trend - I think it is a soft trend," he said of the declining violence.
Carafano pointed to the problem of integrating the Sunni awakening councils into Iraqi society and keeping the Shiite militias out of the fight. If either of those situations changes, he said, increased bloodshed in the country is likely.
Those warnings in mind, Carafano said he thought the "surge" in U.S. troops had to a large extent met one of its important goals: to allow the Iraqi government to focus on questions of governance instead of dealing only with security.
He likened the increase in troops to the Marshall Plan that largely rebuilt Europe after World War II and demonstrated U.S. commitment to that continent.
"I think the surge made that statement to Iraqis," Carafano said. "Here's America, fighting an unpopular war and things aren't going so well and we turn around and send more troops in. To the good guys and the bad guys is was a reaffirmation that Americans aren't going to walk away from this."