The company planning the largest nuclear project in the United States, two giant reactors in South Texas, announced on Tuesday that it was giving up and writing off its investment of $331 million after uncertainties created by the accident in Japan.

But the project — planned by NRG, a New Jersey-based independent power producer, and its minority partner, Toshiba — was in considerable doubt even before the accident at Fukushima began on March 11. Texas has a surplus of electricity and low prices for natural gas, which sets the price of electricity on the market there.

The project could go forward if circumstances changed, said David Crane, the chief executive of NRG, but he said the prospect of that occurring was “extremely daunting and at this point not particularly likely.”

The plan was for the South Texas Project 3 and 4 reactors, and was identified more than two years ago by the Energy Department as one of the four candidates for loan guarantees that were authorized by the 2005 Energy Act.