Huber Matos, a former Cuban revolutionary who fought alongside Fidel Castro, but later turned against him and was jailed before going into exile, died in Miami early Thursday aged 95.

The cause of death was a "massive heart attack," according to a statement released by the family.

The day before he died Matos spoke to supporters in Cuba, the statement said, adding that his last words were: "The struggle continues, long live a free Cuba."

Matos supported the Castro revolution against Fulgencio Batista in the 1950s, flying weapons to Cuba from Costa Rica before joining Castro's Rebel Army in the Sierra Maestra mountains.

After Batista fled the island, Matos rode into Havana on a tank at Castro's side in January 1959. He was later named army commander in the province of Camaguey, but soon resigned in protest over Castro's communist tilt.

Matos was arrested and tried for treason in December 1959. Sentenced to 20 years in jail, he was released in 1979 and returned to Costa Rica to join his wife and children, before moving to Miami.

He was active politically in the anti-Castro movement in Miami, serving as secretary general of a political party, Cuba Independiente y Democratica (CID).

He requested to be buried in Costa Rica, but also asked to have his remains reburied alongside his parents in his Cuban hometown of Yara, when "Cuba is free," the family said.