The former head of Colombia's secret police, Maria del Pilar Hurtado, has appeared in court in Bogota.
She was detained in Panama on Friday night after turning herself over to the authorities.
Ms Hurtado is facing charges of illegally spying on political opponents of the former Colombian President, Alvaro Uribe.
She fled Colombia in 2010 after the allegations were made public and was granted asylum in neighbouring Panama.
The decision caused outrage in Colombia, especially because of close links between Mr Uribe and the Panamanian president at the time, Ricardo Martinelli.
Last year the Panamanian Supreme Court revoked Ms Hurtado's asylum.
High security unit
Her whereabouts were unknown for months until Interpol on Friday issued an international arrest order.
Hours later she gave herself up to the Colombian authorities in Panama and was put on a plane to Bogota.
Judge Gerson Chaverra in Bogota considered that her arrest was lawful.
He said she will remain in a high security unit at the Prosecutor's Office in Bogota awaiting trial.
"We need to take precautions to prevent any attempt against her life," said Mr Chaverra.
Ms Hurtado was head of the now-defunct Department of Administrative Security (DAS) between 2007 and 2008.
The DAS answered directly to the president but Mr Uribe denied any involvement in the scandal.
He said at the time Ms Hurtado fled to Panama that he never issued any orders that violated Colombian law or the Constitution.
Those allegedly targeted include politicians, journalists, judges and even the head of the Colombian Supreme Court at the time, Jaime Arrubla.
Mr Uribe, who was in office between 2002 and 2010, is now a senator in the opposition to President Juan Manuel Santos.