Alan Gross, an American contractor who has been jailed in Cuba since 2009 for bringing banned telecommunication devices into the country with the purpose of setting up internet services, has been released by the Cuban government.

Gross is en route to the US after a prisoner swap deal was reached between the Obama administration and Havana for his release on humanitarian grounds, according to a senior US official.

In return for Gross' release, the US agreed to the humanitarian release of three Cuban prisoners - also convicted of espionage after being found guilty of spying in Miami - who were held in North Carolina.

Gross, 65, is believed to be in poor physical condition with his lawyer described him an almost toothless, blind in one eye and lacking the ability to walk due to arthritis of the hips.

He had been detained in a room at a military hospital for 24 hours a day along with two other Cuban political prisoners.

Gross, who has spent five of his 15-year term in a Cuban prison, sued the government and the contractor he was working for, Maryland-based Development Alternatives Inc. in 2012 on allegations they failed to give him proper training and warnings before the assignment.

He was arrested while working to set up Internet access for the Cuba's Jewish community as a subcontractor for the US Agency for International Development.

In a statement released earlier this month, his wife Judy said: "Enough is enough. My husband has paid a terrible price for serving his country and community."

The release of an American prisoner from Cuba represents a landmark agreement in a relationship which has been beset by a diplomatic stalemate.