A woman passes antiterrorism posters pasted along the streets of Urumqi, in the Xinjiang region of far western China. (Goh Chai Hin/Agence France-Presse via Getty Images)

On a rocky hilltop close to the city of Urumqi in China’s troubled Xinjiang region, five men appear on a video wearing black bandanas decorated with Arabic writing. A black flag used by jihadist groups across the world flutters behind them as they press their hands together in a circle and pledge their allegiance to holy war.

In another video, the bearded leader of those men is in his kitchen, where he first spits on and then burns small flags belonging to the United States, Britain and several Muslim nations — before stomping, with a bare foot, on a Chinese flag placed on the countertop.

The home videos look like an amateurish attempt to copy those produced by al-Qaeda and Islamic State militants, but there is nothing comical about what happened later.

The bearded man, identified by Chinese authorities as Usmen Hasan, drove an SUV flying a black flag into Beijing’s Tiananmen Square last October. The vehicle plowed through pedestrians and rammed into tourist barriers in front of the Forbidden City, then exploded into flames, killing its three occupants and three other people, and injuring 39.

Hasan exemplified China’s great fear — that a long-running nationalist insurgency in Xin­jiang was morphing into a terrorist movement inspired by a foreign brand of radical Islam and that domestic Uighurs were taking their cue from fellow Uighur extremists schooled in the madrassas of Pakistan and on the battlefields of Afghanistan.

A police van is parked near the main entrance of the Forbidden City in Beijing on Oct. 29, 2013. A day earlier, an SUV struck pedestrians and rammed into tourist barriers, then burst into flames, killing its three occupants and two people outside. (Kim Kyung Hoon/Reuters)

Foreign-trained Uighur militants may not yet be returning to China — Beijing believes many have made their way to Iraq and Syria — but their message of jihad is starting to resonate here. Critics say that message is landing on fertile ground in Xinjiang because of Beijing’s repressive policies, but for China, jihad is a terrorist threat that cannot be tolerated.

It is a threat that also has global implications. As its concerns about radical Islam grow, China has joined the United States in trying to force Pakistan to do much more to crush its centers of jihad and to take military action against terrorist training camps. Here, China’s interests are squarely aligned with those of the United States.

Washington hopes the fear of extremists will encourage Beijing to join it in a global coalition against militants from the Islamic State, with national security adviser Susan Rice raising the subject in recent meetings with senior Chinese leaders.

“Their concerns about terrorism at home and abroad are rising,” said a senior administration official, who spoke on the condition of anonymity because he was not authorized to comment on the issue, “and we are interested in exploring what the opportunities are in ways that are consistent with American interests and values.”

Since that Tiananmen Square attack, a gruesome knife attack at a railway station in Kunming and the bombing of a market in Urumqi killed scores of people, while the imam of the main mosque in Kashgar, China’s westernmost city, was murdered in July, supposedly because he had “twisted” the Koran and did not support jihad against China, according to one suspect’s confession aired on state television.

China says the violence is inspired by an Islamist militant group based in Pakistan’s tribal areas. The group, known as the East Turkestan Islamic Movement or Turkestan Islamic Party, is made up of radical Uighurs who want to establish an Islamic state in Xinjiang.

The group’s roots go back decades. Pakistani author Ahmed Rashid said he saw scores of

Uighurs being taught in madrassas in his country in the early 1990s and then training with a terrorist outfit called Lashkar-e-Taiba. Many were sent to Afghanistan to be hardened in battle alongside the Taliban.

Since then, Uighur militants have formed links with al-Qaeda, as well as with radical counterparts from Uzbekistan and Chechnya, said Rashid, author of “Jihad: The Rise of Militant Islam in Central Asia.”

“The Chinese are really very, very upset,” said Rashid, adding, with a reference to Pakistan’s intelligence service, “They came down very hard on the ISI and army to do something about it, to clean up their act.”

‘Huge latent threat’

For the past two years, China says, the militants have been producing a slew of video and audio messages to inspire Uighurs back home.

“Extremist thoughts are spreading mainly through the Internet, and through underground scripture classes,” Erkin Tuniyaz, the vice chairman of the regional government, told reporters in Urumqi.

The videos contain exhortations to jihad, show militants training together or dispense advice on how to make bombs. Some celebrate attacks in Xinjiang and urge their followers to carry out more.

University of Michigan political scientist Philip Potter says the attacks in Xinjiang have become more sophisticated. “The assassination of the imam is important,” he added, referring to the murder in Kashgar. “Radicalized groups tend to target collaborators. It forces the community to take sides.”

In recent weeks, Chinese television has broadcast a series of confessions by Uighurs suspected of involvement in attacks, paraded in orange or blue prison vests, their wrists often cuffed to tables. Many are young, just 18 or 19, and appear to have little knowledge of the Koran or Islamic teachings, according to state media reports.

Potter said the extremist fringe outside China is not only an inspiration to groups within China but also a “huge latent threat.”

“The concern is about people sneaking back in,” he said, arguing that they might not inspire a coordinated uprising so much as convince others to join them in sporadic acts of violence. “Individual skill sets and credibility count for a lot. Cells popping up spontaneously can become a lot more capable and a lot more prevalent.”

China has stepped up its surveillance of Uighurs in Xinjiang specifically to counter that threat and to spot outsiders quickly.

But China’s focus on the external inspiration for some of the violence in Xinjiang is missing the bigger picture, experts say.

The long-running and brutal suppression of Uighur rights, culture and nationalist sentiment has bred deep resentment here, while an intensified campaign to “educate” people by turning them away from Islam — preventing women from wearing veils

and students from attending mosques, for example — seems to have caused even more anger.

“The mainstream frustration and sentiment in Xinjiang is anti-China nationalism,” Rashid said. “But if China does not change its policy, the mainstream will no longer be nationalist, it will be extremist.”

Indeed, China’s suppression of religious practice in Xinjiang appears to have caught the attention of the global jihadist movement.

In July, the leader of the Islamic State, Abu Bakr al-Baghdadi, was reported to have mentioned China at the head of a list of more than a dozen countries or regions where Muslims are repressed, urging his followers to send “brigades” to help their “brothers.”

That may have encouraged Beijing to refrain from its usual reflexive criticism of U.S. foreign policy when the Obama administration bombed Islamic State militants in Iraq. The Foreign Ministry told the China Daily newspaper that Beijing was keeping “an open attitude” about developments.

In late July, Wu Sike, then the Chinese special envoy to the Middle East, said at a news conference that he understood from foreign news reports that about 100 Chinese nationals, mostly Uighurs, were being trained or were fighting with the Islamic State. This month, Iraq’s Defense Ministry posted a picture on its Facebook page to announce that it had, for the first time, captured a Chinese national fighting with militants there.

Xu Yangjingjing contributed to this report.