He called for an all-out “struggle against terrorism, infiltration and separatism” using the “organs of dictatorship” and to show “absolutely no mercy.”

The documents do not record him directly ordering the creation of the detention facilities, but he ascribed Xinjiang’s instability to the widespread influence of toxic beliefs and demanded they be eradicated.

Attacks overseas spurred worries at home.

Terrorist attacks abroad and the drawdown of American troops in Afghanistan heightened the leadership’s fears and helped shape the crackdown. Officials argued that attacks in Britain resulted from policies that put “human rights above security,” and Mr. Xi urged the party to emulate aspects of America’s “war on terror” after the Sept. 11 attacks.

Mr. Xi signaled a break from the policies of his predecessor, Hu Jintao, who responded to deadly 2009 riots in Xinjiang’s capital, Urumqi, with a clampdown but also stressed economic development as a cure for ethnic discontent — longstanding party policy.

“In recent years, Xinjiang has grown very quickly and the standard of living has consistently risen, but even so ethnic separatism and terrorist violence have still been on the rise,” Mr. Xi said in a speech to party officials. “This goes to show that economic development does not automatically bring lasting order and security.”

A new boss in the region ordered mass roundups.

The internment camps in Xinjiang expanded rapidly after the appointment in August 2016 of a zealous new party boss for the region, Chen Quanguo. He distributed Mr. Xi’s speeches to justify the campaign and exhorted officials to “round up everyone who should be rounded up.”

Mr. Chen led a campaign akin to one of Mao’s turbulent political crusades, in which top-down pressure on local officials encouraged overreach, and any expression of doubt was treated as a crime.