Ms. Sheinbaum’s security strategy also includes strengthening the city’s police force. Since she took office in December, the city has increased police salaries and hired 3,000 new officers. The police force is planning to increase the number of officers by almost 50 percent, to 24,000, she said.

Mr. López Obrador said last week that his government had originally considered it unnecessary to send the National Guard to Mexico City, which has a largely functional police force of its own.

But progress has not come fast enough, the president said.

Homicide rates in the city of almost nine million people have jumped as much as 50 percent in some months, compared with a year earlier, although in other months they have remained relatively stable. In May, for example, there were 157 homicides; in May 2018 there were 98.

Luis Wertman, the director of Trust and Citizen Impulse, a civil organization that focuses on security issues, agreed that violence was rising and blamed past city administrations, which he said failed to pay enough attention to security and crime prevention.

Still, he argued that the National Guard was unnecessary. Mexico City has one of the country’s best-trained local police forces in the country, and the deployment of militarized forces could prompt a backlash in the famously liberal city, he said.

While other cities have been accustomed to a military presence over the past dozen years, since former President Felipe Calderón first sent the military to fight drug gangs, the capital’s residents are wary of the armed forces — a legacy of the military crackdowns on student and opposition protests in the late 1960s and early 1970s, Mr. Wertman said.

“Historically, Mexico City has rejected the military patrolling of the streets,” he said.

Francisco Rivas, the director of Observatorio Ciudadano, a crime watch group, lamented what he described as the “effective militarization of public security,” and said the deployment left many questions unanswered: “questions about training, accountability and specific objectives.”