Lockheed Martin on Wednesday announced that it would acquire a Massachusetts company that helps protect electrical grids, oil and gas pipelines and other pieces of critical infrastructure against cyberattacks.

The purchase of Industrial Defender, which has more than 130 employees, is part of a move by the massive, Bethesda-based defense contractor to expand its cyber business into commercial markets as the federal government cuts defense spending. And it comes amid increased warnings that the nation’s power grid is vulnerable to attack.

“Industrial Defender’s expertise in cyber security for critical infrastructure is a natural extension of our commercial cyber security business,” Marillyn Hewson, Lockheed Martin chairman, president and chief executive, said in a news release.

Last year, President Obama issued an executive order designed to strengthen protections for critical infrastructure and a congressional report found that many utility companies were under constant attack — many from hackers in China, Russia and Iran. One utility said it came under 10,000 attacks a month.

“The rate of such cyber-attacks against American corporate and government infrastructure is on the rise and unlikely to abate,” according to the report, released last year by then-Rep. Ed Markey (D-Mass.), who is now in the Senate.

“These vulnerabilities pose substantial risks to U.S. national security,” the report said.

In 2012, more than 30,000 computers at the Saudi Arabian Oil Co., a state-owned oil company, were destroyed by a virus that also damaged computer systems at RasGas, an energy company in Qatar.

While such threats are now a focus of Congress and the White House, much of Industrial Defender’s time was dedicated to “increasing awareness of the implications of successful cyber-breaches,” president and chief executive Brian M. Ahern said in a statement posted on the company’s Web site.

The company has grown steadily and now helps 400 companies in 25 countries protect their operations.

Lockheed and Industrial Defender “share a common perspective on the importance of protecting global critical infrastructure from an increasingly hostile threat landscape,” Ahern said in the news release.

Terms of the deal, including the sale price, were not disclosed. The acquisition is expected to close in 30 days.

Chandra McMahon, a Lockheed vice president of commercial markets, said the company already helps many defense and government agencies protect against cyberthreats. But in recent years Lockheed has been focused on “expanding our business to commercial markets,” she said.

In addition to helping utilities thwart cyberattacks, she said, the company is expanding into the pharmaceutical and financial industries. The acquisition also helps Lockheed broaden its international reach, she said.

Philip Finnegan, director of corporate analysis at Teal Group, said the acquisition fits into Lockheed’s strategy of taking services it had sold to government agencies and finding new areas in the private sector to apply them.

“What Lockheed is doing is taking its core expertise and looking at what are the potential markets that are growing,” he said.