In the spring of 2010, a sheik in the government of Qatar began talks with the U.S. consulting company Booz Allen Hamilton about developing a plan to build a cyber-operations center. He feared Iran’s growing ability to attack its regional foes in cyberspace and wanted Qatar to have the means to respond.

Several months later, officials from Booz Allen and partner firms met at the company’s sprawling Tysons Corner campus to review the proposed plan. They were scheduled to take it to Doha, the capital of the wealthy Persian Gulf state.

I’ve searched wide and far for maps that can reveal and surprise and inform in ways that the daily headlines might not.

That was when J. Michael McConnell, a senior vice president at Booz Allen and former director of national intelligence in the George W. Bush administration, learned that Qatar wanted U.S. personnel at the keyboards of its proposed cyber-center, potentially to carry out attacks on regional adversaries.

“Are we talking about actually conducting these operations?” McConnell asked, according to several people at the meeting. When someone said that was the idea, McConnell uttered two words: “Hold it.”

Calls were made to U.S. government officials and experts in the elite world of defense consulting. It became clear to McConnell that the notion of conducting attacks was a deal-killer.

“We can’t have Americans at the keyboard running offensive operations,” said McConnell, a retired admiral who also ran the top-secret National Security Agency, according to those present. “It could be interpreted as an act of war.”

The Qatar incident highlights the reality of a new arms race — the worldwide push to develop offensive and defensive cyber-capabilities. Like many other countries, Qatar wanted to improve its computer defenses in the face of a growing network warfare threat. And like others, Qatar turned to the United States, where technology firms are acknowledged leaders in the field of cyberwarfare and cyberdefense.

The potential worldwide market means that U.S. companies must walk a fine line between selling their products and staying within export controls that are struggling to keep pace with the rapid technological advances in the field.

After Booz Allen backed off, so did Qatar. But not for long, in the case of Qatar.

A senior Middle Eastern diplomat seconded that view, saying Saudi Arabia is convinced that Iran attacked Aramco “to send a message that we can hurt you.” But identifying the sources of cyberattacks is tricky, and some experts said they see no evidence that Iran was behind the episodes.

Iran understands the potential damage from a cyberattack. A virus called Stuxnet, attributed to Israel and the United States, disabled hundreds of centrifuges at its primary uranium enrichment plant in 2009 and 2010. Last year, Iran announced that it had started its own military cyber-unit, and Tehran has been blamed for several cyberattacks.

Qatar, Saudi Arabia and countries such as Kuwait, Oman and the United Arab Emirates now are clamoring for cyber-tools and expertise. Like Qatar in 2010, many want help from the U.S. government and U.S. companies. Saudi Arabia is setting up a cyber-unit for defensive purposes and Saudi Aramco has hired U.S. consultants to help protect its networks.

The United States and its defense contractors have long sold sophisticated arms to allies and provided training in their use. Cyber-technology is the latest weapon to emerge as a product.

The export of these tools and instructions for using them is new enough that industry and government are still struggling to define a threshold that ensures that U.S. firms remain competitive in the global market, that allies can defend themselves and that the skills and technology do not wind up in the wrong hands.

U.S. officials note that they can regulate only U.S. companies. “There’s a lot more to be worried about when it comes to firms, organized crime, and others outside the United States who may recognize there are certain countries and organizations willing to pay quite a lot of money” for destructive malware and other cyber-capabilities, said a senior U.S. defense official who was not authorized to speak on the record. “That is extremely worrisome.”

But helping friendly countries boost their cyberdefenses against a common foe is desirable to many in and out of the U.S. government.

“Every modern country in the world is creating some sort of offensive or defensive cyber-capability either in its military or intelligence service,” said Richard A. Clarke, a former senior U.S. counterterrorism official whose firm Good Harbor provides cybersecurity advice but does not currently work for any foreign government in that area. “It’s getting to be the norm.”

Benjamin A. Powell, a former national security official, said the uncertainty of the new terrain means companies are treading carefully. “It’s a sensitive thing for a company to go down the path of training for offense, even with approval,” said Powell, a partner at the WilmerHale law firm who advises companies on export controls. “You’re closer to the pointy end of the spear.”

One challenge is that technology is evolving so quickly that it is difficult for the rules to keep up. Another is that the field is so new that many companies, especially smaller ones, may not always know what is required.

“There’s not a lot of convention and structure around this,” Powell said.

Under State Department export-control rules, U.S. companies need a license to train foreign governments in cyber-capabilities for a national security purpose. License applications are reviewed by the Pentagon’s Defense Technology Security Administration. The National Security Agency, which conducts electronic surveillance on foreign intelligence targets overseas, may also be consulted.

The State Department declined to say how many licenses have been issued. But one company, CyberPoint of Baltimore, was granted a license to provide advice on cyberdefense and policy to the United Arab Emirates. In September, the UAE established the National Electronic Security Authority to protect its computers against cyberthreats. Cyber Point declined to talk about the UAE license, but industry officials said its work is defensive, not operational.

Industry officials interviewed for this article spoke on condition of anonymity because of the sensitivity of the topic and to avoid antagonizing customers.

The August attacks on RasGas and Saudi Aramco have been traced to a virus dubbed Shamoon. Experts said it wasn’t overly sophisticated and was built using commercially available software. But it nearly destroyed more than 30,000 business network computers at Aramco and erased backup copies of data. Operating systems had to be reinstalled, and for two weeks the company could not conduct business.

Given that Saudi Arabian oil provides the vast majority of the kingdom’s income and keeps the world’s markets relatively stable, shielding Saudi infrastructure from cyberattacks has emerged as a top priority.

Saudi Arabia has been talking with Department of Homeland Security and other U.S. officials to “set up a system where it can provide protection against cyberattacks,” said the senior Middle Eastern diplomat.

Technology industry officials said the U.S. government will not approve licenses that would allow a company’s personnel to conduct attacks on behalf of another country. And they said there are general concerns about how sophisticated a capability the United States should provide even a friendly country.

Booz Allen is not the only U.S. company to offer cyber services. So do major defense contractors such as Lockheed Martin, Northrop Grumman and General Dynamics. And the list of allies looking to buy their cyber-wares extends well beyond the Middle East.

But not everyone looks to the United States for help. Ecuador and Venezuela have turned to Cuba, where experts have been trained by top-tier Russians, according to industry officials.

“You thought we had the Wild West now in cyberspace?” said a former senior U.S. official. “We haven’t seen it yet. We thought it was script kiddies hacking computers from their basement, criminal gangs hacking businesses. We haven’t seen the Wild West of nation states and hacktivist organizations flexing cyber-muscle.”

Comments our editors find particularly useful or relevant are displayed in Top Comments, as are comments by users with these badges: . Replies to those posts appear here, as well as posts by staff writers.

To pause and restart automatic updates, click "Live" or "Paused". If paused, you'll be notified of the number of additional comments that have come in.

Comments our editors find particularly useful or relevant are displayed in Top Comments, as are comments by users with these badges: . Replies to those posts appear here, as well as posts by staff writers.