ARLINGTON, Va. - Alan Gross has called himself a "trusting fool" for going to Cuba in the first place. Family and friends described him with other words: gregarious and outgoing, with a talent for picking up and playing any musical instrument.

Gross, 65, was freed from prison Wednesday as part of an agreement that included the release of three Cubans jailed in the United States, officials said.

His wife, Judy Gross, has called him a humanitarian and an idealist, someone who was "probably naive" and did not realize the risks of going to Cuba as a subcontractor for the federal government's U.S. Agency for International Development.

Gross was arrested in 2009 while working in the communist-run country to set up Internet access for the island's small Jewish community, access that bypassed local restrictions and monitoring. Cuba considers USAID's programs illegal attempts by the United States to undermine its government. Gross was tried and sentenced to 15 years in prison.

In court in Cuba, Gross called himself a "trusting fool" who never meant any harm to the Cuban government. But reports he wrote about his work showed he knew it was dangerous.

"This is very risky business in no uncertain terms," he wrote in one report. A 2012 investigation by the Associated Press found he was using sensitive technology typically available only to governments.

During the five years he was imprisoned, family members said, Gross never grew angry at the Cuban people. He watched Cuban baseball and even jammed with his jailers on a stringed instrument they gave him.

On Friday nights, Gross would take out a picture of a group of friends celebrating the Jewish sabbath, and he would say the prayers they would say together.

On Wednesday, a spokeswoman for the family said Gross and his wife walked hand-in-hand onto a military plane for the trip home. Onboard were bowls of popcorn, another thing he had missed, and a corned beef sandwich on rye. When the pilot announced they were leaving Cuban airspace, Gross stood up and took a deep breath.

His first telephone calls were two his two daughters.

"I'm free," he told them.