Sao Paulo, Brazil - Brazil's President Michel Temer has signed an emergency decree authorising the country's armed forces to take over policing duties in Rio de Janeiro.

The emergency measure, the first of its kind since Brazil returned to democracy after the end of a military dictatorship in the mid-1980s, comes amid rising violence and a spike in crime.

It takes effect immediately and will last until the end of the year, the government announced on Friday.

Temer, who officially signed the order during a televised ceremony, said his government "will take all necessary steps to confront and defeat organised crime and gangs".

"There is no way out, we can't wait one more day," Rio de Janeiro Governor Luiz Fernando Pezao also said, as quoted by Brazilian newspaper O Globo.

The order was quickly criticised by opposition figures, however, who derided it as a cynical move by the widely unpopular and scandal-plagued Temer, whose approval rating hovers around five percent, to look presidential in an election year.

Brazil's security crisis will likely be a deciding factor in October's general elections, with law-and-order candidates gaining in popularity.

It is also understood that a long-awaited pension reform vote, thought necessary to get Brazil's public finances in check, will be delayed because of the security intervention.

"Temer uses a very serious problem, which is security in Rio de Janeiro, to try to take his government from the mud. He doesn't have the votes for pension reform and sought a way out to camouflage his failure," Ivan Valente, a left-wing opposition congressman, said on Twitter.

Violent deaths mounting

Violent deaths in Rio de Janeiro state - home to 16 million people, with 6.5 million living in Rio de Janeiro city - have steadily climbed in recent years.

Twenty-nine violent deaths were recorded per 100,000 residents in 2012 - the lowest total on record - but then jumped to 38 per 100,000 residents in 2016, when Rio hosted the Summer Olympics, according to government figures.

By September 2017, the number had increased even further, to 40 violent deaths per 100,000 residents.

During the carnival celebrations, which began last week and ended on Tuesday, images of mass robberies and looted supermarkets made national headlines.

In the lead up to the popular festival, at least two children were shot and killed, the first by an armed gang and the second during a shoot-out in a favela during a police operation, while three military police officers were also shot dead in violence unrelated to carnival.

Last year, 134 police officers were killed in Rio, while police killed more than 1,000 people, the highest tally in nearly 10 years, according to government figures.

Heavy gun battles happen on an almost daily basis in the city of Rio, especially in the favelas - poor, mostly unregulated shanty towns inside and around the city - and other peripheral neighbourhoods, where three main drug gangs and several militia groups battle for control of territory and against the police.

A much-heralded police pacification programme, launched before the 2014 World Cup and 2016 Olympics in some of Rio's favelas to take back territory from organised crime, has largely failed.

Some of the highest numbers of violent deaths have been recorded in favelas where the scheme was implemented, often the result of brutal police incursions.

Financial crisis

A lack of adequate resources "has led to a drop in police morale and the quality of policing, with their salaries often going unpaid or late, as well as unpaid bonuses", said Rafael Salies, a risk advisory consultant based on in Rio de Janeiro.

In fact, Rio's spike in violence is broadly blamed on an acute fiscal crisis, the result of Brazil's broader economic downturn, a drop in state oil revenues and widespread unemployment in the construction industry after the city hosted the Olympics two years ago.

State government corruption and economic mismanagement have also been blamed, as former Governor Sergio Cabral is currently serving decades in prison on corruption charges.

Today, it remains one of the most indebted states where Brazil's economic crisis has hit hardest, despite it being one of the richest.

But Rio is far from one of Brazil's most violent states.

In 2016, according to the Brazilian Forum for Public Security, the northeastern state of Sergipe led the ranking with 64 violent deaths per 100,000 residents.

Meanwhile, Ignacio Cano, a professor and head of the Violence Analysis Lab at Rio de Janeiro State University, derided the emergency decree as question of image control as well as the militarisation of public security.

Cano told Al Jazeera that a recent change in Brazilian law now means that armed forces personnel who kill civilians can only be judged in military courts, which are notoriously slow and non-transparent.

He said he envisioned two possible scenarios: armed forces would be deployed across Rio at a high cost, but with little effect, or they will take up an aggressive strategy that "could be very bloody".

"The problems of public security are different from national security and cannot be fought with tanks and heavy gunfire; you need investigation and the army is not prepared for that," Cano said.