Energy Department officials were warned that their plan to help a failing solar company by restructuring its $535 million federal loan could violate the law and should be cleared with the Justice Department, according to newly obtained e-mails from within the Obama administration.

The e-mails show that Energy Department officials moved ahead anyway with a new deal that would repay company investors before taxpayers if the company defaulted. The e-mails, which were reviewed by The Washington Post, show for the first time concerns within the administration about the legality of the Energy Department’s extraordinary efforts to help Solyndra, the California solar company that went bankrupt Aug. 31.

The FBI raided Solyndra last month, shortly after it closed its doors.

The records provided Friday by a government source also show that an Energy Department stimulus adviser, Steve Spinner, pushed for Solyndra’s loan despite having recused himself because his wife’s law firm did work for the company. Spinner, who left the agency in September 2010, did not respond to requests for comment Friday.

The documents offer new evidence of wide disagreement between officials at the Energy Department and officials at the Treasury Department and Office of Management and Budget, where questions were raised about the carefulness of the loan vetting process used to select Solyndra and the special help it was given as its finances deteriorated. Energy Department officials continued to make loan payments to the company even after it had defaulted on the terms of its loan.

The Solyndra controversy has escalated with each new release of documents to a Republican-led House energy subcommittee investigating the matter. President Obama defended the Energy Department in a news conference Thursday, saying its decisions were made by career professionals. Also Thursday, the head of the embattled loan program announced that he would step down, although Energy Department officials said he was not doing so because of the Solyndra matter.

As Republican committee leaders moved to get more information about warnings from Treasury and the OMB, an Energy spokesman, Damien LaVera, said agency officials had listened to Treasury’s advice to consult the Justice Department on the loan restructuring but felt it was appropriate to move forward.

“Ultimately, DOE’s determination that the restructuring was legal was made by career lawyers in the loan program based on a careful analysis of the statute,” he said.

The e-mails show that Mary Miller, an assistant Treasury secretary, wrote to Jeffrey D. Zients, deputy OMB director, expressing concern. She said that the deal could violate federal law because it put investors’ interests ahead of taxpayers’ and that she had advised that it should be reviewed by the Justice Department.

“To our knowledge that never happened,” Miller wrote in a Aug. 17, 2011, memo to the OMB.

In February, the restructuring was approved by Energy Secretary Steven Chu.

Company executives said they needed a quick cash infusion to save the company, and private investors agreed to contribute $75 million if loan repayment terms were modified.

Solyndra ran out of money anyway and sought bankruptcy court protection, leaving 1,100 employees out of work. The loan refinancing now makes it likely that taxpayers will have to make up most of the loss, the e-mails show. The Treasury Department’s general counsel had concluded that the renegotiated loan violated the law because it allowed private investors to be first in line for repayment in case of a default.

Those private investors include investment funds linked to George Kaiser, a Tulsa billionaire and Obama fundraiser. Kaiser has said he had no involvement in the loan.

The correspondence also suggests that, at the most senior levels at the White House and down through its ranks, the Obama administration wanted to use the Solyndra loan to highlight progress under the stimulus act.

Republicans on the House Energy and Commerce Committee, which has been investigating the loan, issued a statement Friday saying the correspondence showed a “disturbingly close relationship between President Obama’s West Wing inner circle, campaign donors, and wealthy investors.”

“After 8 months of stonewalling by this Administration, today we finally learn one of the reasons why they fought our investigation every step of the way,” the statement said.

One participant in the Solyndra effort, according to the e-mails, was Spinner. He pressed for OMB officials to speed up review of the Solyndra loan, writing at one point: “Any word from OMB? I have the OVP [Office of the Vice President] and WH [White House] breathing down my neck on this.”

Spinner came from Silicon Valley to serve as a senior adviser on the loan program, and his wife was a lawyer with Wilson Sonsini, the law firm representing Solyndra in its application. Despite an ethics agreement under which he said he would recuse himself from Solyndra’s loan application, correspondence shows that Spinner defended the company, worked to get the president or vice president to visit its factory, and pushed for a final decision on approving the company’s loan.

“How [expletive] hard is this?” Spinner wrote to a career staffer on Aug. 28, 2009, asking for answers about final approval from an OMB official. “What is he waiting for? Will we have it by the end of the day?”

In an Aug. 19, 2009, e-mail, an aide to then-White House Chief of Staff Rahm Emanuel asked Spinner if he could discuss any concerns among the investment community about Solyndra.

Spinner dismissed the idea that Solyndra had financial problems.

“I haven’t heard anything negative on my side,” he said.

A day after a discussion about possible problems at Solyndra, Spinner forwarded to the chief of staff’s aide a list of Solyndra’s main investors and attached a published profile of Kaiser.

Spinner is now a fellow at the Center for American Progress, a Democratic think tank.

A senior administration official declined to comment Friday when asked if Spinner violated his recusal agreement.

LaVera, the Energy Department spokesman, said Spinner “was authorized to oversee and monitor the progress of applications, ensure that the program met its deadlines and milestones, and coordinate possible public announcements,” because his wife gave up payments related to loan project clients. “He was not allowed to make decisions on the terms or conditions of any particular loan guarantee or decide whether or not a particular transaction was approved,” LaVera said. “This arrangement was reviewed and approved by the department’s career ethics officer.”

The e-mails also added more evidence that venture capitalists had access to senior White House decision makers.

David Prend, whose firm Rockport Capital was also a Solyndra investor, wrote a March 2009 e-mail to the White House two weeks before Solyndra won conditional commitment on its loan. Prend thanked Greg Nelson, a White House clean-technology aide, for meeting with him.

“It was great to meet you with [then-White House climate czar] Carol Browner last week,” he wrote. “I look forward to working with you to get the message out and to effect real change in the Energy Industry. I will follow up shortly on 2 of the companies we discussed,” mentioning Solyndra as one.

Staff writer Steven Mufson contributed to this report.