The Department of Homeland Security has awarded a massive cybersecurity contract, worth up to $1 billion, to Raytheon, which it hopes will shore up the federal government’s defenses against the increasing onslaught of attacks.

The contract, one of the largest civilian cybersecurity orders in years, would help more than 100 federal civilian agencies protect their networks against malicious hackers, and it comes after the Office of Personnel Management suffered one of the most damaging breaches in history.

The OPM recently said that hackers stole the fingerprints of 5.6 million people, far more than previously thought. The attacks are believed to have affected more than 21 million former and current government employees, whose personal information, including Social Security numbers and information used in security clearances, may have been compromised.

The Obama administration has said it has made cybersecurity a top priority, and Congress has pushed to expand the nation’s defenses and make them more robust. The Pentagon is also taking steps to develop ways to fend off hackers, who often only have to find one crack in a network, while defenders have to guard the entire wall.

At a hearing on cybersecurity Tuesday, Sen. John McCain (R-Ariz.) said that in the past year, Iran, North Korea, China and Russia have all launched cyber­attacks on the United States. And he said the rate of the attacks has increased, “crippling or severely disrupting networks across the government and private sector and compromising sensitive national security information.”

He added: “Far more needs to be done to develop the necessary capabilities to deter attacks, fight and win in cyberspace.”

In a statement announcing the contract Monday, Dave Wajsgras, president of Raytheon’s Dulles, Va.-based intelligence, information and services business, said that cyber incidents have increased an average of 66 percent a year between 2009 and 2014.

“Today’s cyber threats are increasingly pervasive and serious, and our government and private sector institutions require the best protection possible,” he said.

The five-year contract is a huge win for the company, which has invested heavily in cybersecurity at a time when some major companies have left the business.

Bethesda, Md.-based Lockheed Martin is reviewing its government IT and technical services business, as it focuses on manufacturing military hardware, such as its F-35 Joint Strike Fighter. And it recently announced it was laying off 500 employees in its Information Systems and Global Solutions segment.

Raytheon, meanwhile, has doubled down, investing $3.5 billion in its cyber division, and expanding in the Washington region, where it has a 30,000-square-foot “cybercenter.”

Raytheon, which is headquartered outside of Boston, is also a finalist in a $2 million Grand Cyber Challenge being put on by the Defense Advanced Research Projects Agency, the Pentagon’s research arm.

In the competition, it will pit technology that automatically finds vulnerabilities in software and fixes them in a “self-healing process” against other teams.

At a tour of its cyber facility this spring, company officials showed off what they call electronic armor, which helps protect operating systems against malware. The protections are increasingly important in the age of the “Internet of things,” where cars, refrigerators and medical devices are all connected to the Web.

In a demonstration, they flew two remote-controlled quadcopters — one with the armor, one without — side by side in a small auditorium. Then they executed an attack using malware already installed on the drones. The one with the protections stayed aloft; the other crashed.