QUITO, Ecuador (AP) _ Days after surviving an impeachment attempt on corruption charges, the vice president of Ecuador resigned Wednesday when a judge ordered his detention.

Vice-President Albert Dahika, the 42-year-old economist considered the chief architect of the government's free-market reforms announced his resignation in a handwritten letter delivered to Congress.

Dahika has denied the corruption allegations. His whereabouts Wednesday night were unknown.

In an order announced earlier Wednesday, Supreme Court President Carlos Solorzano ordered authorities to put Dahika under protective custody in a Quito jail after finding ``indications of guilt'' against him.

``Protective custody'' generally means suspects are held under house arrest to prevent them from fleeing.

There was no immediate reaction from the government. Congress is responsible for naming a new vice president to serve out the rest of President Sixto Duran-Ballen's term, which ends in August.

Opposition congressmen have accused Dahika of bribing legislators and judges with money or jobs after he told journalists in June that lawmakers had blackmailed the administration to get support for legislation. He did not name the people involved.

Dahika had been Duran-Ballen's chief adviser, but the president had asked him to step down, a request he initially refused. An impeachment attempt against Dahika on Friday failed when opposition parties could not get enough votes to find him guilty.

In August, the opposition accused Dahika of having secret bank accounts containing more than $400 million in public funds. Dahika said the accounts were for ``confidential expenses'' related to national security.

He has denied any wrongdoing and has said he was being politically persecuted.