In the approaching twilight of its war in Afghanistan, the U.S. is forging ahead with a giant infrastructure project long criticized as too costly in both blood and money.

It's a $500 million effort to refurbish the massive Kajaki dam and hydro-electric power system with an extensive network of power lines and transmission substations. It is supposed to bring electricity to 332,000 people in southern Afghanistan, increase crop yields and build up a cohort of trained Afghan laborers in a region badly in need of them.

But completion, which originally was envisaged for 2005, now is projected for some time in 2015, the year after most combat troops will have left the country. And there are some crucial ifs:

If a convoy carrying 900 tons of concrete can make it up a dangerous road to the dam site without being attacked by the Taliban. If the Afghan army can hold out in an area that took thousands of U.S. Marines to secure. If the Afghan government can take on the management of the dam.

"It's a long-term bet. I've said to people: We have to be patient and we have to persevere," said Ken Yamashita, the head of USAID in Afghanistan.

The desire to succeed is understandable. The Kajaki dam on the Helmand River symbolizes for both the Afghans and their American backers what they had hoped the infusion of U.S. troops and cash would produce nationwide: an Afghan government that can provide for its people and in turn count on its support against the Taliban insurgency.

The U.S. has spent $22.34 billion on governance and development in Afghanistan since it invaded the country following the Sept. 11 attacks, much of that on projects to build roads, schools, power plants and irrigation systems. In the past two years alone, $800 million was earmarked for infrastructure projects.

Kajaki is also a symbol of the American presence in Afghanistan dating back to the 1950s and the Cold War. That was when the U.S. built the original dam, with a powerhouse added in the 1970s. But before the three turbines could be installed, the Soviets invaded and construction stopped. The dam was still squeezing out a bit of power in 2001 when the U.S. attacked and, ironically enough, bombed the dam's power transmission line.

In the latest phase of the Kajaki saga, fighting as well as limited oversight of spending has led to huge delays and cost overruns, and now Helmand province, home of the Kajaki dam, is seeing the first and largest wave of U.S. troop reductions, with 10,000 of 17,000 U.S. Marines already gone. That means most of the Kajaki project is going forward with Afghan forces providing nearly all the security in an area that was a Taliban stronghold until a year ago.

Afghans here are already hedging their bets.

The number of workers on a U.S.-funded construction project next to Kajaki has dwindled from 200 to 20 since last fall, and those remaining say workers feel the risk isn't worth the $6 daily paycheck.

"They can't come here because all the routes to the district are controlled by the Taliban," said Abdul Razziq, a 28-year-old villager working on construction of a new district government center next to the dam.

His family supports the government, so he at least doesn't have to lie to keep his place of work secret. Not so Timur Shah, who spends a couple of months at a time working at Kajaki. "My immediate family knows I am here. But if anyone else asks they will make something up," he said.

Shah said security improved when U.S. Marines flooded the province, but is deteriorating as the Marines leave.

"Just at the time the American forces started leaving here, the Taliban started to appear again, in the whole area," Shah said.

Cellphone service also stopped working in Kajaki district in late fall. It is common for insurgents to disrupt service in areas they control, though the construction workers say they're just as ready to believe to say the Americans blocked calls.

U.S. officials say the wariness is to be expected at a time of transition. They point out that Afghan security forces have increased their presence around the dam and that attacks, while still regular, appear to be decreasing.

"There's an ebb and flow," said Marine Capt. Glen Baker, one of a small group of Marines who continue to hold an outpost in Kajaki and advise Afghan forces in the area. "There was an increase when the Marines pulled out and there has been a decrease subsequently."

The company working on building the dam has also been able this year to send supplies via road — four convoys of trucks have made the trip without incident. Previously, equipment was being helicoptered in at enormous cost.

The core of the project is the installation of a third power-generating turbine at the dam, an effort that planned since 2002. The installation was originally budgeted at $18 million. Now it is getting another $85 million and is scheduled to be installed in March, after being delayed by efforts to weed out subcontracting applicants suspected of having Taliban ties.

But many in Afghanistan have already given up on Kajaki.

"It is 10 years now that Kajaki dam has been as it is. Too much money has been spent there in the name of reconstruction ... all of that money wasted," President Hamid Karzai said in a speech in December.

Shah, the construction worker, echoed the complaint.

"When the international forces first came here they told us, 'In one year you will have the dam, you will have power, you will have roads.' But that didn't happen. ... and we are still waiting," he said.

Even if the project now overcomes the security and logistical barriers, there are questions about whether it's worth the cost.

The dam can't provide enough power to sustain the main city in the region — Kandahar — and the price tag is steep for the extra irrigation it brings to the Helmand River valley.

And there are also signs of the difficulties the Afghan government may face when it takes over the management of the dam.

One area already controlled by the Afghans is the management of irrigation water. The water has to hold to a certain level through the winter to keep electricity flowing, but last year the manager in charge of irrigation yielded to pressure from farmers and kept the water valve open.

"He ignored the need to close it in September. So the level of water was reduced," said Shaqib Nassar, the utility's chief operations officer, which oversees the dam. As a result the dam can only produce 24 megawatts, rather than 33 megawatts, he explained.

And the Special Inspector General for Afghan Reconstruction, the U.S. government watchdog for spending in the country, said in a report in December that $12.8 million in electricity distribution equipment provided to the Afghan energy utility in Kandahar was sitting unused because the Afghan staff "lacked the technical and operational capacity to properly install and manage it." The Kandahar utility also oversees Kajaki dam.

As recently as mid-2012 the U.S. was considering scrapping the whole project and switching the money to less unwieldy projects. Then it doubled down.

"Several months back we had a lot of discussion about whether continued investment in this would be worthwhile ... There are certainly voices that say, 'We've invested this much, let's finish it,' and there are others that say, 'We've invested this much, however the additional investment just won't get us there,'" said Yamashita, the USAID official.

"In the end, the discussion and the conclusion was that the output of electricity plus the development programs in the Helmand valley, plus the security it brings, equals a risk worth taking."

From the air, the Helmand River is a narrow turquoise ribbon through the desert. The dam is a stacked concrete wall that bisects the river, creating a reservoir ringed with trees — a few spots of green in a vast field of brown.

The helicopters that fly to the dam are owned by a U.S. contractor and depart from a U.S. military base. As resources and Americans become fewer, the U.S. Army Corps of Engineers and USAID say they expect oversight to depend increasingly on Afghan partners. Everyone says they are committed to finishing the project; they'll just have to manage much of it from afar.

Sayed Rasoul is an Afghan engineer with decades spent in the management of Kajaki as well as the Kandahar and Helmand power grid. He says he's confident the dam will be completed and deliver the riches promised.

He also says he's certain that the Americans will be in Kajaki long after the last of the combat troops leave.

"Maybe the American forces will leave here," he said, "but the engineers will be with us."