By Andrew Cawthorne

CARACAS (Reuters) - A former Venezuelan military intelligence head detained on the Caribbean island of Aruba over U.S accusations of drug-trafficking was released and flew home on Sunday.

Instead of being extradited to the United States, retired General Hugo Carvajal flew home after the Netherlands government ruled he had diplomatic immunity, his lawyer and Venezuelan officials said.

Carvajal, who ran military intelligence from 2004 to 2008 during the presidency of the late Hugo Chavez, was arrested on Wednesday after flying to the semi-autonomous island that is part of the kingdom of the Netherlands.

Jubilant Venezuelan officials at a congress of the ruling Socialist Party celebrated his release as a "victory" over their ideological foes in the United States.

"He's returning free and victorious. It's a triumph for sovereignty and legality," President Nicolas Maduro said, praising the "bravery" of the Dutch government.

Opposition politicians in Venezuela and the U.S. government say Carvajal bears responsibility for years of state connivance in the illegal drug trade and aid to Colombian guerrillas. Washington put Carvajal on a blacklist in 2008, accusing him of protecting cocaine shipments from seizure by Venezuela anti-narcotics authorities and providing weapons and shelter to Colombia's FARC rebels on the border.

SMILING CARVAJAL FLIES HOME

He denies those charges, and Maduro on Sunday accused former Colombian president Alvaro Uribe of helping trump them up.

A Venezuelan government plane flew Carvajal the short hop back to his homeland, where he was met and embraced by Foreign Minister Elias Jaua and other senior officials. Dressed in a red T-shirt, Carvajal beamed and looked relieved to be back.

The case had threatened a new flare-up in long-tense relations between Caracas and Washington, as well as potentially stirring up long-simmering accusations of officially sanctioned drug trading by Venezuela.

The liberation overruled a decision on Friday by an Aruba court to reject Carvajal's immunity claim. Though nominated as consul to Aruba, he had not yet been ratified in that post.

Story continues

Carvajal, who took part in the failed 1992 coup that lifted Chavez to political prominence, is considered one of the most powerful figures of the late president's 1999-2013 rule.

Chavez died of cancer last year, and his then vice president, Maduro, won an election to replace him as president, keeping the ruling Socialist Party in power.

Maduro critics were appalled at Carvajal's release.

"I don't understand the reasons or the manner of Holland's decision," said anti-government blogger Miguel Octavio. "It's a victory for crime and power. A defeat for decent Venezuelans."

U.S. officials have not commented publicly on the case.

After flying back to Caracas international airport, Carvajal headed straight for an evening session of the Socialist Party congress, where Maduro greeted and hugged him on stage.

"He's back, he's back!" sang delegates.

(Editing by Cynthia Osterman and Sandra Maler)