WASHINGTON -- Cuba has freed a Cuban man who was imprisoned for nearly 20 years for spying for the United States, American officials said Wednesday as President Barack Obama announced steps toward restoring diplomatic relations.

Obama said the spy provided the information that allowed the U.S. to arrest Cuban agents, including three spies who were part of a group known as the Cuban Five, three of whom were freed as part of the deal. The spy's identity remains classified.

"In exchange for the three Cuban agents, Cuba today released one of the most important intelligence agents that the United States has ever had in Cuba and who has been in prison for nearly two decades," Obama said. "This man, whose sacrifice has been known to only a few, provided America with the information that allowed us to arrest the network of Cuban agents that included the men transferred to Cuba today, as well as other spies in the United States. This man is now safely on our shores."

The Cuban Five were part of the "Wasp Network" sent by then-Cuban President Fidel Castro to spy in South Florida. The men, who are hailed as heroes in Cuba, were convicted in 2001 in Miami on charges including conspiracy and failure to register as foreign agents in the U.S. Two were previously released after finishing their sentences.

The exchange comes as the two countries are starting talked to normalize full diplomatic relations. As part of the new policy, American Alan Gross also was released Wednesday from a Cuban prison. He was serving a 15-year sentence after being arrested in 2009 while working in the communist country to set up Internet access for the small Jewish community.

"Having recovered these two men who sacrificed for our country, I'm now taking steps to place the interests of the people of both countries at the heart of our policy," Obama said.

Brian Hale, spokesman for the director of national intelligence, said the spy provided information that led to the identification and conviction of Ana Belen Montes, a former senior analyst at the Defence Intelligence Agency. She was arrested in 2001 on charges of spying for Cuba and is serving a 25-year prison sentence.

Hale said he helped with the prosecution of retired State Department intelligence analyst Walter Kendall Myers and his wife, Gwendolyn, who were convicted in 2010 of spying for Cuba for nearly 30 years and are serving life in prison without parole.

Administration officials declined to say how the man was able to help with such recent prosecutions when he's been in prison for so long.

"In light of his sacrifice on behalf of the United States, securing his release from prison after 20 years in a swap for three of the Cuban spies he helped put behind bars is fitting closure to this Cold World chapter of U.S.-Cuban relations," Hale said in a statement.