Story highlights Hammar meets his family at the border

Jon Hammar, 27, was jailed in Mexico in August on a questionable gun charge

His family says he was sometimes chained to a bed in a low-security site

The former Marine, who served in Iraq and Afghanistan, was headed to Costa Rica

A former U.S. Marine who languished for more than four months in a Mexican prison on a questionable gun charge was on his way to spending Christmas with his family Friday after U.S. politicians intervened for his release.

Jon Hammar, 27, was released from a facility in the border town of Matamoros, just across from Brownsville, Texas, said U.S. Rep. Ileana Ros-Lehtinen, R-Florida.

"These past few months have been an absolute nightmare for Jon and his family, and I am so relieved that this whole ordeal will soon be over," the congresswoman said in a statement. She represents the family's South Florida district.

U.S. consular officials met Hammar at the prison and escorted him to the border, where he was reunited with members of his family, U.S. State Department spokesman Patrick Ventrell said.

It was August when Hammar, who served in Iraq and Afghanistan, crossed the border on his way to Costa Rica. He was going to go surfing with a fellow veteran and stopped in Matamoros to get gas, his family said.

Along with his surfboards, Hammar took an antique shotgun handed down from his great-grandfather. His parents said that Hammar intended to hunt with it, and that U.S. Customs and Border Protection told him he could bring the gun into Mexico if it was registered and a fee was paid.

JUST WATCHED Father: Mexican guards chain son to bed Replay More Videos ... MUST WATCH Father: Mexican guards chain son to bed 02:49

But after he drove his Winnebago to the Mexican side, authorities arrested him, saying the weapon did not comply with their gun laws.

Olivia Hammar said her son was charged with possession of a weapon restricted for military use. A branch of the Mexican military said the gun is not on its "forbidden list," she said, but her son remained incarcerated.

A few nights after Hammar's arrest, his parents received the first of several threatening calls from behind bars, they said.

"He said: 'I have your son,' " Olivia Hammar recalled, tearing up. "I am going to f--- him up. I already have."

Then she heard her son's voice.

"He said: 'Mom, you've got to do what they say; they're really serious.' "

The voice at the other end of the line asked for $1,800.

For the first few months, Hammar's family kept his plight out of the public eye, fearing media attention would cause him harm in prison. They finally came forward in hopes of getting Mexican authorities to act.

U.S. Sen. Bill Nelson, D-Florida, stepped in on Hammar's behalf, speaking to Mexico's ambassador to the United States. They managed to get him out of the general prison population so he would be away from dangerous inmates.

Hammar was moved to what Nelson said was like an administrative location. But because of the low security at the new facility, which Olivia Hammar described as a storage shed, officials periodically chained Hammar to his bed.

The Hammars recently turned to Ros-Lehtinen, who heads the House Committee on Foreign Affairs. She called the situation "outrageous" and took up the matter with the State Department, the U.S. ambassador to Mexico and the Mexican ambassador.

"I am overcome with joy knowing that Jon will be spending Christmas with his parents, family and friends," she said Friday night.

A defense lawyer said it was determined Hammar had no intent to commit a crime, Nelson said Friday.

"No American should be in a Mexican jail for five months without being able to have his case in front of a judge," Nelson said in a statement. "We're grateful; this is a good Christmas present."

The family said they will spend the holiday "bathed in gratitude" to all those who worked to free their son and gave them support while he was behind bars. They said they would give no interviews until after the holidays.

"The only expression that captures how we feel today is that 'our cup runneth over,'" the family said.