A senior ally of Chinese leader Xi Jinping called for a Mao-style purge of China’s domestic-security apparatus last month, saying it was time to “turn the blade inwards and scrape the poison off the bone.” The cleansing commenced swiftly.

Within the first week after the call to action, Communist Party enforcers had launched investigations into at least 21 police and judicial officials, according to a media tally cited by the party’s top law-enforcement commission. Dozens more have since been taken down, including the police chief of Shanghai, the most senior target thus far, and cadres who have won awards for good performance.

The rash of investigations marks the first time that Mr. Xi has unleashed a sweeping and systematic clean-up of the country’s powerful domestic-security apparatus. His push to forge police, prosecutors and judges who are “absolutely loyal, absolutely pure and absolutely reliable”—as officials running the campaign have demanded—points to thorny concerns that Mr. Xi faces at home even as he seeks to slow a downward spiral in relations with the U.S.

Political observers say the campaign demonstrates the pervasiveness of corruption in China’s criminal-justice system, despite a nearly eight-year effort by Mr. Xi to root out graft and build sustainable one-party rule.