Brazil's justice and security minister Sergio Moro has resigned after clashing with President Jair Bolsonaro over the sacking of the federal police chief.

Mr Moro, a former anti-corruption judge, hit out at "political interference" with the federal police, saying he could not do his job without "autonomy" for the force.

The news sparked jitters in the markets with Sao Paulo's stock exchange, the largest in Latin America, plunging more than 8% and the real dropping to a record low of 5.7 against the US dollar.

"I'm going to start packing up my things and send my resignation letter," said Mr Moro during a long speech in the capital Brasilia in which he accused the far-right Jair Bolsonaro of "breaking the promise of a carte blanche."

Mr Bolsonaro hit back at Mr Moro, accusing him of being motivated by "ego" and making "unfounded accusations."

The president claimed that he had told several politicians before Mr Moro announced his resignation: "Today you will see a person who is committed to himself, to his ego, but not to Brazil."

Brazil's former justice and security minister Sergio Moro

Mr Moro's resignation came after Mr Bolsonaro sacked federal police chief Mauricio Valeixo, a close ally to Mr Moro.

"The change at the head of the federal police without a genuine reason is political interference that harms my credibility and that of the government," said Mr Moro.

Mr Moro said Mr Bolsonaro had told him he was replacing Mr Valeixo because he wanted someone with whom he had "personal contact, whom he could call, ask for information, intelligence reports."

"Providing this type of information is not the job of the federal police," he added, insisting the independence of investigations needs to be preserved.

Mr Moro revealed that Mr Bolsonaro had said one of the reasons he wanted to replace the police chief was that he was "worried" about some ongoing investigations.

Mr Bolsonaro's decision to sack Mr Valeixo against Mr Moro's advice was "a signal that the president wanted me out," said Mr Moro.

The president claimed Mr Moro had agreed to Mr Valeixo's replacement in exchange for a place on the Supreme Court.

But Mr Moro hit back, saying his ally's position "was never used as currency in exchange for me being named to" the top court.

Sylvio Costa, founder of political website Congresso em Foco, said the president's move was about self-preservation.

"Bolsonaro wants to protect himself. It's the federal police that's investigating various suspected crimes haunting the president, his family and allies," said Mr Costa.

Mr Moro made his name as a judge in leading the high-profile Car Wash corruption investigation that notably saw former leftist president Luiz Inacio Lula da Silva jailed for accepting a bribe.

He began investigating leading political figures under a left-wing government in 2014 but said even then he had never before faced such political interference.

An animated projection on a wall in Sao Paulo shows a message calling on people to observe lockdown measures

Analysts say Mr Moro's departure crowns a "politicisation" process of governmental organs battling corruption despite Mr Bolsonaro insisting during his 2018 election campaign that he would provide transparency and honesty.

"Since he assumed the government (in January 2019), Mr Bolsonaro has tried to intervene in a series of anti-corruption organizations with the aim of increasing his control over future investigations," said Thomaz Favaro, an analyst for Control Risks consultancy.

Mr Favaro pointed to Mr Bolsonaro's choice of Augusto Aras as attorney general, despite him not appearing on a list put together by Brazilian public prosecutors.

Picking from that list was a tradition that had been respected since at least 2003.

Last week, Mr Bolsonaro fired his health minister, Luiz Henrique Mandetta, who supported isolation as a tool to contain the spread of the new coronavirus.

Mr Bolsonaro has repeatedly downplayed the danger of Covid-19. 

"Mandetta's vision was that of health, of life. Mine is more than life, it includes the economy and jobs," Mr Bolsonaro said at the time.