A court in Spain has ruled that a man previously heading Venezuela’s military intelligence service should be kept in custody pending decision on an extradition request to the United States.

Hugo Carvajal, a retired general and close ally of late Venezuelan leader Hugo Chavez, appeared at the Spanish High Court on Saturday, a day after his arrest in the capital, Madrid, on the US warrant for drug trafficking charges.

During the hearing, Carvajal denied the accusations by US prosecutors and challenged his potential extradition, a court spokesman said.

Carvajal told the court he left Venezuela a month ago, travelling by boat for 16 hours to reach the Dominican Republic before flying to Madrid.

The former spy chief had fled the country after denouncing Chavez’s successor, Nicolas Maduro, and backing opposition leader, Juan Guaido, who in January declared himself Venezuela’s interim leader.

Carvajal, who retired from the intelligence service in 2012 after leading the agency for 10 years, will fight the US extradition request on the grounds of having ties in Spain, where his family currently resides.

On Friday, the US Justice Department said it had requested Carvajal’s extradition on cocaine-smuggling charges filed in 2011 and unsealed in 2014.

190412195828579

This is the second time Carvajal has been arrested on the US charges, which allege that he coordinated the transportation of 5,600kg of cocaine from Venezuela to Mexico in April 2006. That shipment was bound for the US, according to charges filed in a federal court in New York.

Carvajal was arrested on the Dutch Caribbean island of Aruba in 2014, but the Dutch government accepted Venezuela’s argument that he had diplomatic immunity because he had been nominated consul to Aruba.

The former intelligence chief was previously sanctioned by the US government in 2008 for “materially assisting the narcotics trafficking activities” of Colombia’s FARC rebel group.

In February, Carvajal, who was also a member of Venezuela’s Congress, became one of the most prominent politicians to turn against Maduro.

“We can’t allow an army, in the hands of a few generals subjugated to Cuban instructions, to become the biggest collaborator of a dictatorial government that has plagued people with misery,” he said in a video posted on Twitter.

Maduro then demoted and expelled Carvajal from the military. He was also accused of “acts of treason”.

Guaido was later recognised by the US and dozens of governments, but Maduro remains in office with the support of the military and has denounced Guaido as a puppet of Washington.