Workmen at Sandia National Laboratories test for energy irregularities in a machine. (Sandia National Laboratories)

The world’s largest defense contractor has agreed to pay $4.7 million to settle charges that it used government money illegally to lobby top federal officials for an extension of its contract to run one of the country’s premier nuclear weapons labs.

Over five years, starting in 2009, a Lockheed Martin subsidiary — which was being paid by the federal government to run Sandia National Laboratories — lobbied members of Congress and senior Obama administration officials for a seven-year extension of the contract, according to the settlement the Justice Department announced Friday.

Company executives, who allegedly hired a former New Mexico congresswoman to help them, didn’t just press people with influence to  continue a relationship worth $2.4 billion a year to Lockheed, as Energy Department Inspector General Gregory Friedman concluded in an investigation last fall.  They also urged that the contract be closed to competition.

[IG: Contractor and ex-lawmakers improperly lobbied for no-bid contract worth $2.4 billion a year]

“The money allocated by Congress for the Sandia National Laboratories is designed to fund the important mission carried out by our national laboratories, not to lobby Congress for more funding,” Principal Deputy Assistant Attorney General Benjamin C. Mizer, head of the Justice Department’s Civil Division, said in a statement.

Mizer alleges that Sandia Corp., the Lockheed subsidiary, used federal money to lobby Congress and other federal officials from 2008 and 2012 “to receive a non-competitive extension” of its contract in violation of federal law.

The case opened a window on the inner workings of power and influence in Washington. It’s not surprising that a big, politically connected defense contractor would lobby hard to keep a lucrative slice of federal business. But this case went further. Taxpayers, not Lockheed’s corporate lobbying arm in Bethesda, Md., were paying for the influence peddling.

[Inspector General casts doubt on Energy contract work by ex-New Mexico congresswoman]

Excerpt from guidance that former New Mexico Republican Rep. Heather Wilson gave Lockheed Martin officials to ensure that the company’s contract to run a premier nuclear lab would be renewed. (Source: Energy Dept. Inspector General)

“Using public funds to lobby for a non-competitive extension of a contract is simply unacceptable,” Friedman said in a statement.

Heather Clark, spokeswoman for Sandia National Laboratories, said the lab “has agreed to settle with the Department of Justice to put the matter behind us, take action on what we learned and focus on our important national security mission.”

She said Sandia executives “believed our actions for a contract extension fell within allowable cost guidelines,” but now realize that they “acted too early and too independently in planning for a possible contract extension.”

The investigation has “clarified” Sandia’s understanding of “our legal obligations on interacting with public officials,” Clark said.

To clinch the contract extension, Sandia labs officials hired high-priced consultants — including Heather A. Wilson, the former New Mexico congresswoman, who allegedly was paid $226,000 — to write up a “contract extension strategy.” Among the tactics allegedly suggested by Wilson was “working key influencers” by targeting then-Energy Secretary Steven Chu’s staff, his relatives and friends, and his former colleagues at another federal lab — all with the goal of keeping Lockheed Martin in charge of Albuquerque-based Sandia.

Last fall, Friedman alleged that Sandia hired Wilson’s consulting firm and two unnamed former employees of Energy’s National Nuclear Security Administration, which oversees the nuclear labs. Wilson’s company, Heather Wilson LLC, gave explicit guidance to the Sandia team on how to influence important people in Washington who would decide whether Lockheed’s contract would be renewed, authorities say.

“Lockheed Martin should aggressively lobby Congress, but keep a low profile,” she advised, according to meeting notes authorities say were obtained by the inspector general’s investigation.

Lockheed, which also manufactures the $400 billion F-35 Joint Strike Fighter, has contracted with the Energy Department to run Sandia since 1993. The research lab is part of the government’s nuclear weapons complex, with facilities in Albuquerque and Livermore, Calif.

The inspector general said that Sandia’s push for a long-term no-bid contract extension under the Obama administration was not the lab’s first lobbying attempt at taxpayers’ expense. “Perhaps [Sandia] felt empowered because it had improperly directed Federal funds to similar activities in the past,” investigators wrote last fall.

In a 2010 e-mail, a Sandia official said using laboratory staff members to pursue contract extensions was not a big deal, because it had been done before.

“We used operating costs in the same way in securing the extensions in [1998] and 2003,” the official wrote.

Wilson was not just on Lockheed’s payroll. From 2009 through 2011, she had consulting jobs with three other contractors managing the Energy Department’s national laboratories. The four contractors charged the department a total of $450,000 for fees paid to Wilson, according to the inspector general’s report.

But the contractors could not document her work, said Friedman, whose staff found that the justification for the billing did “not meet even minimum standards” for federal payments and that there was an “absence of detailed evidence of the actual services [she] provided.”

Wilson, who left Congress in 2009 after an unsuccessful run for the Senate,  has publicly denied that she took part in any lobbying involving the Sandia contract. She told The Post last year, “I was not a lobbyist for Sandia and I did not contact any federal official — congressional or executive — for Sandia to try to extend the Sandia contract.”

But Friedman at the time said she was “deeply, deeply involved” in Lockheed’s effort to renew its contract.

Friday’s settlement was disparaged by bloggers critical of the national labs. Jay Coghlan of Nuclear Watch New Mexico called the deal a “slap on the wrist for the world’s biggest defense contractor to pay.”

“Lockheed Martin clearly broke the law by engaging in illegal lobbying activities to extend its Sandia contract without competition, and earned more than 100 million dollars while doing so,” Coghlan wrote on the NuclearWatch blog, calling for criminal prosecution of the company.

Lockheed “engaged in deep and systemic corruption, including paying Congresswoman Heather Wilson $10,000 a month starting the day after she left office for so-called consulting services that had no written work requirements.”

Lockheed has received a series of one-year contract extensions to run Sandia since 2012, and its existing contract runs until 2017. The next contract is now up for competitive bid.

Christian Davenport contributed to this report.