The decree confers sweeping authority on the military to restore order. It also places police forces, which have had shortages of personnel and equipment, under the command of a general, Walter Souza Braga Netto, who oversees military operations in the eastern part of the country.
“Together, the police and the armed forces will combat and confront those who have kidnapped our cities,” Mr. Temer said at the signing ceremony in Brasília. “Prison cells will no longer be thieves’ personal offices. Public squares will no longer be the reception halls for organized crime.”
Experts questioned the timing and motivation of the decision. It comes as Mr. Temer, who took office after his predecessor was impeached in 2016, has been weighing whether he has a chance of being elected president in October, despite his single-digit approval numbers.
According to a poll last month, 38 percent of Brazilians said public security was a major concern as they considered whom to vote for. In Rio de Janeiro, violent crime, after gradually declining for almost a decade, has surged in the past two years.
In 2017, there were 6,731 violent deaths in the state of Rio, or 40 per 100,000 residents — the highest level in eight years. Carjackings, robberies of cellphones and kidnappings also increased.
The decree not only shows Mr. Temer being tough on crime, it also delays a vote on an unpopular legislative proposal on pensions that looked increasingly doomed to failure. Under the Constitution, Brazilian lawmakers are barred from making sweeping legal changes during a military intervention imposed by decree.
“On the political level, Temer might be killing two birds with one stone,” said Christopher Harig, an expert on civilian-military relations in Brazil at King’s College London. “At the same time he creates an excuse for not being able to pass the social security reform.”
Mr. Temer, who announced that he would travel to Rio on Saturday for a meeting on security, insisted that the pension overhaul could still be voted on by temporarily lifting the decree.
Brazil’s military leaders have expressed deep concern as the federal government has increasingly turned to the armed forces to quell outbreaks of violence around the country.
Gen. Eduardo Villas Bôas, the country’s top military commander, said recently that the armed forces could not be expected to solve a security crisis rooted in longstanding problems that other government agencies had failed to meaningfully address.
“Combating organized crime requires effective action by the government in economic and social spheres, in order to make drug trafficking less appealing in areas where a large segment of the population is grappling with unemployment,” General Bôas wrote in an email.
“Even as the military has been called to act in different areas, sometimes for lengthy periods,” he added, “we don’t observe considerable changes due to lack of engagement by government agencies responsible for other areas.”
Newsletter Sign Up
Thank you for subscribing.
An error has occurred. Please try again later.
You are already subscribed to this email.
After Brazil was selected to host the 2014 World Cup and the 2016 Olympics, officials adopted an ambitious plan to transform poor districts that had long been hubs for drug gangs by adopting a community policing model that was supposed to pave the way for better schools, sanitation, health care and jobs.
Those plans fell short amid pervasive corruption, and Brazil entered a long recession that left the state of Rio de Janeiro bankrupt.
General Bôas also warned that permanently deploying military personnel to the front lines of Rio’s drug wars increased the risk that soldiers might become complicit in organized crime.
“These criminal structures, especially those linked to drug trafficking with international ties, make it far more likely that institutions will become tainted,” he said in his email. “There’s a possibility that troops could become tainted.”
In Mexico, the use of the military to fight organized crime has produced mixed results. Since 2006, when Felipe Calderón, then the president, first authorized the use of the military, more than 200,000 people have been killed in drug-related violence, according to official statistics, prompting the United Nations to declare that “there is an urgent need to decrease the involvement of the military in policing.”
In Rio, as the police have lost control of large areas, well-armed drug gangs have acted as the de facto authority in several teeming communities known as favelas. Critics accuse the police of using heavy-handed tactics, limiting their effectiveness, and say some members of the force have colluded with criminal organizations.
For Rita de Cassia Santos de Silva, a 53-year-old street cleaner, the military would be an improvement over the police.
“I’m afraid of the police,” she said. “They go in and take whatever they want. I think people really only obey the army.”
But Raquel da Silva, a newspaper vendor, said she did not have high expectations. “The situation is out of control,” she said. “People are getting killed for a cellphone, But it’s not up to the police or the army — the problem lies much higher up. For us in poor communities, it’s just going to get worse.”
This is the first time such a decree has been issued since the Constitution was drawn up in 1988, at the end of Brazil’s military dictatorship, although the armed forces have become something of a fixture in the Rio. They have been called in to support the police during special events like the Summer Olympics in 2016, when more than 80,000 officers, soldiers, traffic officers and firefighters provided security for the Games.
“We have seen the affect of using military to police Rio,” said Jurema Werneck, executive director of Amnesty International Brazil. “There was a significant increase in human rights violations, especially in the case of young, black men.”
Under the Constitution, military intervention in a state can be decreed for a number of reasons, including when a foreign country invades Brazil, when the government wants to prevent secession or when there is a “serious” threat to public order.
Over the past few days, Brazilian television stations have broadcast images of bloody shootouts in the city’s favelas, and of Carnival tourists being chased down Ipanema Beach and beaten by robbers.
Governor Pezão acknowledged that the deployment of 17,000 police officers was not enough. “We weren’t prepared,” he told TV Globo.
The decree will be sent to Congress and requires approval by a simple majority in both houses within 10 days before it can take force. According to news media reports, the armed forces will be in charge of security until Dec. 31.