EDS NOTE : SPANISH LAW REQUIRES THAT THE FACES OF MINORS ARE MASKED IN PUBLICATIONS WITHIN SPAIN. Accompanied by family members, former Venezuelan military spy chief, retired Maj. Gen. Hugo Carvajal, center, enters into a car after walking out of prison in Estremera, outskirts of Madrid, Spain, Sunday, Sept. 15, 2019. Spain's National Court has rejected the extradition to the United States of a former Venezuelan military spy chief accused of drug smuggling and other charges. Within hours of Monday's ruling, the court released retired Maj. Gen. Hugo Carvajal, who claimed that the extradition request was politically motivated. (AP Photo/Manu Fernandez)

MADRID (AP) — Spain's National Court says it rejected the extradition to the United States of a former Venezuelan military spy chief accused of drug smuggling and other charges because the charges lacked detail and accepted the defense's claim that it was politically motivated.

The court's ruling released Tuesday said it rejected the request also because retired Maj. Gen. Hugo Carvajal had been acting under his military obligations when he committed the alleged crimes.

Carvajal was freed from a Madrid prison Monday. He headed Venezuela's military intelligence agency for more than a decade and was a close aide to former Venezuelan leader, Hugo Chávez.

The U.S. sought his extradition when he fled to Spain this year after publicly supporting opposition's efforts to oust Venezuelan President Nicolás Maduro.

The ruling can be appealed.

EDS NOTE : SPANISH LAW REQUIRES THAT THE FACES OF MINORS ARE MASKED IN PUBLICATIONS WITHIN SPAIN. Accompanied by family members, former Venezuelan military spy chief, retired Maj. Gen. Hugo Carvajal, center, walks out of prison in Estremera, outskirts of Madrid, Spain, Sunday, Sept. 15, 2019. Spain's National Court on Monday rejected the extradition to the United States of a former Venezuelan military spy chief accused of drug smuggling and other charges. (AP Photo/Manu Fernandez)
EDS NOTE : SPANISH LAW REQUIRES THAT THE FACES OF MINORS ARE MASKED IN PUBLICATIONS WITHIN SPAIN. Accompanied by family members, former Venezuelan military spy chief, retired Maj. Gen. Hugo Carvajal, center, walks out of prison in Estremera, outskirts of Madrid, Spain, Sunday, Sept. 15, 2019. Spain's National Court on Monday rejected the extradition to the United States of a former Venezuelan military spy chief accused of drug smuggling and other charges. (AP Photo/Manu Fernandez)
Former Venezuelan military spy chief, retired Maj. Gen. Hugo Carvajal walks out of prison in Estremera, outskirts of Madrid, Spain, Sunday, Sept. 15, 2019. Spain's National Court on Monday rejected the extradition to the United States of a former Venezuelan military spy chief accused of drug smuggling and other charges. (AP Photo/Manu Fernandez)
EDS NOTE : SPANISH LAW REQUIRES THAT THE FACES OF MINORS ARE MASKED IN PUBLICATIONS WITHIN SPAIN. Accompanied by family members, former Venezuelan military spy chief, retired Maj. Gen. Hugo Carvajal, center, walks out of prison in Estremera, outskirts of Madrid, Spain, Sunday, Sept. 15, 2019. Spain's National Court has rejected the extradition to the United States of a former Venezuelan military spy chief accused of drug smuggling and other charges. Within hours of Monday's ruling, the court released retired Maj. Gen. Hugo Carvajal, who claimed that the extradition request was politically motivated. (AP Photo/Manu Fernandez)