Peru's attorney general late Monday dismissed a team investigating the far-reaching Odebrecht corruption scandal, setting off street protests in cities across the country.

President Martin Vizcarra quickly denounced the move, saying it undercuts Peru's drive to purge corruption.

"The head-on fight against corruption and impunity is a priority of this government," Vizcarra said on Twitter.

Two of the five supreme prosecutors called the decision by Attorney General Pedro Chavarry "a death blow" to the anti-corruption fight and urged him to reverse it.

The dismissal came just weeks before the Brazilian construction giant was set to reveal key evidence against powerful former Peruvian officials.

Executives at Odebrecht have acknowledged that it distributed millions in bribes across Latin America, including $29 million in Peru, to obtain lucrative government contracts.

The prosecutor's office is investigating all the Peruvian presidents who governed from 2001 to 2018 for alleged crimes of corruption and money laundering.

Chavarry's action set off demonstrations by hundreds of citizens in the capital of Lima and three other cities. Protesters shouted phrases like "Out with Chavarry" as they waved Peruvian flags.

The attorney general called a news conference to announce his decision but he then took no questions. He said the dismissal was necessary to nullify the appointment of the prosecutor heading the team of investigators.

The removal imperils an agreement with Odebrecht to participate in the investigation entailing some 40 separate cases.

"I fear that the Brazilian company will back off because it is not going to have guarantees of what had been achieved with the prosecutors," Odebrecht prosecutor Jorge Ramirez told a local radio station.

Prosecutor Jose Domingo Perez was investigating opposition leader Keiko Fujimori for allegedly laundering $1.2 million from the construction company for her 2011 presidential campaign. The leader of the Popular Force Party is imprisoned for 36 months while she is being investigated.

Perez was also investigating former President Alan Garcia for allegedly receiving $ 100,000 from Odebrecht and got a judge to bar the former president from leaving Peru.

Perez returned to his office at night to safeguard the documentation of the cases he investigates.

"I feel indignant, disappointed. It is an irregular decision, the anti-corruption fight is affected," he told reporters.