U.S. Secretary of Defense Chuck Hagel said that the fighting force at U.S. Cyber Command will number more than 6,000 people by 2016. (Mark Wilson/Getty Images)

The Pentagon is significantly growing the ranks of its cyberwarfare unit in an effort to deter and defend against foreign attacks on crucial U.S. networks, Defense Secretary Chuck Hagel said Friday.

In his first major speech on cyber policy, Hagel sought to project strength but also to tame perceptions of the United States as an aggressor in computer warfare, stressing that the government “does not seek to militarize cyberspace.”

His remarks, delivered at the retirement ceremony of Gen. Keith Alexander, the outgoing director of the National Security Agency and Cyber Command, come in advance of Hagel’s trip to China next week, his first as defense secretary. The issues of cyberwarfare and cyber-espionage have been persistent sources of tensions between Washington and Beijing.

Hagel said that the fighting force at U.S. Cyber Command will number more than 6,000 people by 2016, making it one of the largest such ­forces in the world. The force will help expand the president’s options for responding to a crisis with “full-spectrum cyber capabilities,” Hagel said, a reference to cyber operations that can include destroying, damaging or sabotaging an adversary’s computer systems and that can complement other military operations.

But, Hagel said, the military’s first purpose is “to prevent and de-escalate conflict.” The Pentagon will maintain “an approach of restraint to any cyber operations outside of U.S. government networks.”

Although some U.S. adversaries, notably China and Russia, which also have formidable cyber capabilities, may view his remarks with skepticism, Hagel said the Pentagon is making an effort to be “open and transparent” about its cyber­forces and doctrine. The hope, senior officials said, is that transparency will lead to greater stability in cyberspace.

To underscore the point, Hagel’s speech was broadcast live from NSA headquarters at Fort Meade, the first such broadcast from the agency.

“The most important point is we want people to understand the reality of what our policies are,’’ said a senior defense official, who spoke on the condition of anonymity to discuss the Pentagon’s thinking. “We only engage in cyber operations when it is something that is important, either providing options to the president, defending the [department] networks or, most importantly, ensuring the security of the United States and critical infra­structure.”

Tensions over U.S. cyber operations intensified again last weekend after a report that the NSA had penetrated the networks of a Chinese telecommunications giant, Huawei Technologies, in search of evidence that it was involved in espionage operations for Beijing and to use its equipment to spy on adversaries such as Iran. After the disclosure, first reported by the New York Times and Der Spiegel, China demanded a halt to any such activity and called for an explanation.

Such reports make it all the more important for the Pentagon to be candid, the senior official said.

“We want the Chinese to understand what it is we’re doing in building a cyber­force at Cyber Command, understand how we operate, understand the policies we use, like the policy of restraint,” the official said in a call with reporters before the speech.

Analysts said that China and Russia were unlikely to be convinced by Hagel’s remarks. Revelations about the NSA’s activities, based on documents provided by former contractor Edward Snowden, make U.S. assertions that it is focused on protecting U.S. national security — and not actively infiltrating others’ networks — that much harder to accept, they said.

Alexander, a 62-year-old Army general, is retiring after more than eight years at the NSA’s helm — the longest-serving agency director — and after 40 years of military service. His last year has been, arguably, the most turbulent of any director’s as the agency has been buffeted by the disclosures.

On Friday, Hagel praised Alexander’s service, saying that he led the agency “through countless intelligence break­throughs and successes” and that his vision is driving the buildup of Cyber Command to an “elite, modern cyber­force.”

“Cyber will be a part of all future conflicts,” Hagel said, repeating a point that Alexander has made over the years.

Cyber Command’s teams will support regional combatant commands, safeguard department networks and defend the nation in the event of a major cyberattack on the United States, officials say. Their capabilities will be integrated into the services.

Alexander, who is expected to be succeeded by Vice Adm. Michael S. Rogers, did not specifically mention Friday the public disclosures over the past year of dozens of NSA programs or the push to place new restrictions on the agency’s operations in the aftermath of those leaks. But he praised NSA employees “for doing your job when many would have walked away. Thanks for not losing hope, faith and courage.”

The agency’s employees deserve credit, Alexander said, for “12-plus years without a major terrorist attack on our soil.”

Greg Miller contributed to this report.