CHICAGO — For years, President Trump railed against “carnage” in Chicago, bemoaning the gun violence that has torn through many neighborhoods throughout the city. In June 2017, his administration sent more federal agents to the city as part of an anti-gang task force with the Chicago Police Department, charged with ramping up gun enforcement efforts.

“Crime and killings in Chicago have reached such epidemic proportions that I am sending in Federal help,” Mr. Trump tweeted at the time.

Early Friday, a federal agent in that task force was shot in the face and critically wounded during an investigation in what is regarded as a dangerous pocket of Chicago’s Southwest Side, the authorities said. The shooting set off a sprawling manhunt.

The A.T.F. agent is expected to survive; no arrests have been made in the shooting.

The incident was a significant blow to the task force, known as the Chicago Crime Gun Strike Force, a permanent unit that officials have described as the first of its kind in the country.