Castillo was removed from office on Wednesday in an impeachment trial, after he tried to dissolve Congress illegally in a bid to stay in power that backfired as his former allies and ministers turned on him.

He was arrested hours later, and television images showed him arriving Wednesday night in a helicopter, his hands tied together under a blanket and amid extensive security measures, at the headquarters of the Department of Special Operations (Diroes) in the east of the capital.

The source said 53-year-old leftist Castillo had been detained at the headquarters, where Fujimori - who ruled Peru with an iron fist between 1990 and 2000 - is serving a 25-year term for human rights abuses and corruption in a purpose-built cell.

Police and judicial authorities declined to comment on Castillo's current whereabouts, and Reuters could not immediately reach his lawyers.

His former Vice President, Dina Boluarte, was sworn in as the country's first woman leader on Wednesday evening.

Castillo had tried to avoid Wednesday's impeachment trial, previously scheduled and the third he has faced in a year, by announcing the dissolution of parliament, a move that sparked ministerial resignations and allegations of a coup.

Peru's public prosecutor said Castillo had been detained on allegations of rebellion, acting unconstitutionally and conspiracy against the government.

A former teacher and farmer, he took office in July 2021 after winning a tight election against Fujimori's eldest daughter, Keijo Fujimori, a conservative who remains a major force in parliament.

The elder Fujimori, 84, is the only convicted prisoner in a complex that was built for him at Diroes prior to his extradition from Chile in 2007 and subsequent trial.

According to the National Penitentiary Institute (INPE), Fujimori has a cell with a bedroom, bathroom, study and access to a patio where he tends a garden.

Fujimori successfully dissolved Congress and took over the judiciary in 1992, a measure supported by the armed forces and police at a time when the country was battling a Maoist guerrilla insurgency and facing an economic crisis.

After an international outcry, Fujimori held legislative elections and in 1993 drafted a new constitution, favoring a free market economy.

Castillo, unlike Fujimori, lost the support of his government and the armed forces after he threatened to dissolve Congress.

The judicial source told Reuters that although both former presidents are in the same prison headquarters, they are not together. Castillo is being held in a police cell, while Fujimori's cell complex is administered by INPE.

"Castillo is expected to give his first formal statements to prosecutors in the rebellion and conspiracy investigations on Thursday," the source said, adding his former Prime Minister, Aníbal Torres, was serving as his lawyer.

Former president Ollanta Humala was also preliminarily detained at the Diroes headquarters between July 2017 and April 2018, while he was being investigated for alleged corruption.

(Reporting by Marco Aquino; Writing by Steven Grattan; Editing by Adam Jourdan and John Stonestreet)

By Marco Aquino