A Cuban national was allowed to provide sperm to impregnate his wife while he was incarcerated on spying charges at a U.S. federal prison, officials revealed Monday, NBC News reported.

Gerardo Hernandez is one of three Cuban prisoners the U.S. released last week in exchange for the release of American contractor Alan Gross, who was held in Cuba for alleged espionage for five years.

The artificial insemination was made possible after Senator Patrick Leahy, a Vermont Democrat, traveled with his wife to Cuba in February as part of an ongoing effort to patch up relations with the U.S., NBC News reported.

While in Cuba Leahy met Hernandez's wife, Adriana Perez, who contacted the senator after learning he was in town. Meanwhile, Hernandez and four other Cubans, labeled the "Cuban Five," remained in the U.S. where they were imprisoned since 1998 for allegedly spying on anti-Castro exile groups in Florida.  

"[Perez] was probably 42 or 43 and she had no expectation her husband was ever getting out [of] prison- he was serving two consecutive life sentences- and she was desperate to have a child, knowing she was almost out of time," Rieser told NBC News.

Leahy and his wife Marcelle, who are both grandparents, "sympathized with her on a human level and they wanted to help her, and they did it for her," Rieser continued.

Once back in the U.S., Rieser made inquiries with the State Department and the Bureau of Prisons and was told conjugal visits were prohibited. However, there was the possibility of artificial insemination. Government officials understood the need to do something for the Cuban prisoners while Cuba was carrying out requests to help the ailing Alan Gross.

"They understood that the Senator's purpose was purely humanitarian," Rieser told the station. "We were also asking the Cubans to do things that would help improve the condition of Alan Gross."

The request was granted and Hernandez's sperm was retrieved and flown to Cuba. It took two attempts but the insemination worked and Hernandez and Perez are now happy, expecting parents, the station reported.

Perez is expected to give birth in two weeks.