Brazil's Senate has overwhelmingly approved a military intervention in Rio de Janeiro that was first proposed by President Michel Temer last week - the latest step in the president's crackdown on crime and social unrest ahead of a hotly contested local election coming later this year.

As we noted last week, Temer is ordering the military to restore order in the drug-ravaged streets of Rio in the largest intervention since Brazil's return to Democracy in the mid-1980s. A collapse in public spending on social services has caused crime to reemerge in Brazil's slums, spiking to levels unseen since 2009.

The decree, which was issued on Friday, had already passed the House, and the Senate vote was the final obstacle to a military takeover of the local police. However, per the AFP, while support for the crackdown is broad-based, it also has its critics: There is particular controversy over government calls for the army-led police to be able to serve mass search and arrest warrants in favelas.

In fact, the prosecutor Deltan Dallagnol, who ran infamous anti-corruption operation car wash - which nearly ensnared Temer - said there's no legal precedent or justification for such mass searches of favelas.

"The penal code does not authorize serving collective or generic search warrants. On the contrary, it demands the greatest possible precision in the homes being searched," he tweeted.

Furthermore, there's concern that the crackdown - which was inspired by a series of street robberies during Carnevale festivities in the city - will lead to abuse of the poorest most vulnerable citizens while doing little to address systemic problems like pervasive poverty and poor access to education.

However, the horrifying stories of the crime wave have helped rally popular support for the crackdown.

"When we see delinquents holding up a street stall with a rifle we can see how serious the situation is. The population lives in terror," said Senator Eduardo Lopes, a leader in the Senate who supported the decree.

Rio's security situation has been deteriorating rapidly since the city hosted the 2016 Summer Olympics. Heavily armed drug gangs have made certain neighborhoods in the favelas virtually off limits to the police.

While regular police are still doing most of the work on the streets, generals are now in command, with troops available as back-up.

The vote passed 55 to 13.