Four years ago, planners at the Pentagon reviewed estimates of China’s growing military investments with what one called a “palpable sense of alarm.” China, the planners determined, was making advances that would erode America’s military might—its ability to project power far from its shores. The search began for technologies that could give the U.S. a new warfighting edge against its rival.

The officials were particularly impressed by one artificial-intelligence project. The program could scan video from drones and find details that a human analyst would miss—identifying, for instance, a particular individual moving between previously undetected terrorist safe houses.

“That was the ‘Aha!’ moment I had been looking for,” said William Roper, then the head of the Pentagon’s Strategic Capabilities Office. His superiors quickly latched onto the potential of America’s world-leading efforts in artificial intelligence. The U.S. could maintain its advantage, they hoped, by exploiting the growing ability of computer systems to adapt rapidly to novel conditions, respond autonomously and even make certain decisions within rules set by programmers.

The problem, according to U.S. officials, is that China’s People’s Liberation Army was closely watching the Pentagon’s technology search, and some of its officers soon had an “Aha!” moment of their own. The turning point was March 2016, said Elsa Kania, a specialist on Chinese military innovation at the Washington-based Center for a New American Security. That was when Google’s DeepMind used AI to defeat a world champion in the ancient Chinese game of Go. The outcome, she said, persuaded the Chinese military that AI could surpass the human mind and provide an advantage in warfare. Last July, China unveiled plans to become the world’s dominant power in all aspects of artificial intelligence, military and otherwise, by 2030.

The U.S. now finds itself in an escalating AI arms race. Over the past two years, China has announced AI achievements that some U.S. officials fear could eclipse their own progress, at least in some military applications. “This is our Sputnik moment,” said Robert Work, the former deputy secretary of defense who oversaw the Pentagon’s move into the new field.