(Recasts with resignation)
LIMA, Nov 24 (Reuters) - Leftist Peruvian President Pedro Castillo has accepted the resignation of his prime minister and will reshuffle his Cabinet once again, he said on Thursday, amid a lengthy battle between the executive and legislative branches.
Former Prime Minister Anibal Torres, a staunch ally of Castillo, had challenged the opposition-controlled Congress to a confidence vote last week. But Congress declined to hold such a vote on Thursday, saying conditions for it had not been met.
"Having accepted the resignation of the prime minister, whom I thank for his work on behalf of the country, I will renew the Cabinet," Castillo said in an national television broadcast.
The confidence vote challenge was meant to pressure Congress amid tense relations between the two branches of government.
Opposition lawmakers have twice impeached Castillo but failed to oust him, although they have managed to censure and fire several Cabinet members.
"I call on Congress to respect the rule of law, the rights of the people, democracy and the balance of state powers," Castillo added.
His presidency has been marked by turnover in senior government positions. Castillo is now set to name a fifth prime minister - his top adviser and spokesperson - since taking office in July last year.
Confidence votes are controversial in Peru as they can come with significant consequences.
If Congress had issued a vote of no confidence, Torres and the entire Cabinet would have been forced to resign.
But a new Cabinet could then call for a second confidence vote which, if also denied, would allow the executive to shut down Congress and call new legislative elections.
Last week, Torres said he would interpret a lack of a vote as the equivalent of a no-confidence vote.
Castillo stopped short of saying Congress had issued a vote of no confidence, although at least one close ally, former commerce minister Roberto Sanchez, said the legislature's decision meant confidence had been withheld.
In 2019, then Peruvian President Martin Vizcarra shut down Congress and called for new elections after two no-confidence votes.
Congress then passed a law limiting the situations that merit confidence votes, which is now being tested for first time.
Tension between the different branches of Peru's government is common, and Peruvians have lived under five different presidents since 2016. (Reporting by Marcelo Rochabrun; Editing by Paul Simao and Clarence Fernandez)