By Daniel Trotta and Jeff Mason
HAVANA/WASHINGTON (Reuters) - The United States and Cuba on Wednesday formally agreed to restore diplomatic ties that had been severed for 54 years, fulfilling a pledge made six months ago by the former Cold War enemies.
U.S. President Barack Obama and Cuban President Raul Castro exchanged letters agreeing to reopen embassies in each other's capitals, with the Cubans saying that could happen as soon as July 20.
"This is a historic step forward in our efforts to normalize relations with the Cuban government and people and begin a new chapter with our neighbors in the Americas," Obama said from the White House Rose Garden.
U.S. Secretary of State John Kerry, speaking from Vienna, said he would visit Havana later this summer to raise the U.S. flag outside the U.S. embassy, currently labeled the U.S. interests section under the protection of the Swiss government.
Obama and Castro seek to relegate to history 56 years of recriminations that have predominated ever since Fidel Castro's rebels overthrew the U.S.-backed government of Fulgencio Batista on Jan. 1, 1959.
"Cuba is encouraged by the reciprocal intention to develop respectful and cooperative relations between our two peoples and governments," Raul Castro, 84, Fidel's younger brother and Cuban president since 2008, wrote in his letter to Obama.
The Cuba deal marks a major achievement for Obama, who has been criticized for foreign policy stumbles, especially in the Middle East. It follows his recent victory in a congressional fight for fast-track authority that could undergird a landmark Asia trade deal and comes as Washington appears to be on the cusp of a nuclear agreement with Iran.
Following 18 months of secret negotiations brokered by Pope Francis and Canada, the two leaders announced separately but simultaneously in December that they planned to reopen embassies in each other's capitals and normalize relations. The agreement also included a prisoner swap.
With diplomatic relations restored, the United States and Cuba will turn to more difficult bilateral problems.
Cuba's Communist government said in a statement that to have normal overall relations, the United States must rescind its comprehensive economic embargo of Cuba and return the naval base at Cuba's Guantanamo Bay, which it has leased since 1903. Cuba wants the 45 square miles (116 square km) restored as its sovereign territory.
Obama, a Democrat, has asked the Republican-controlled Congress to lift the 53-year-old embargo, but the conservative leadership in Congress has resisted.
The Cuban statement said the United States also needed to halt radio and television broadcasts beamed into the country and stop "subversive" programs inside Cuba, which the U.S. says are intended to promote democracy in the one-party state.
Two years after Fidel Castro came to power, President Dwight Eisenhower closed the U.S. embassy in Havana on Jan. 3, 1961, less than three weeks before President-elect John F. Kennedy took office.
By April of that year, Kennedy would authorize the U.S.-organized invasion of Cuba by a force of Cuban exiles. The attack at the Bay of Pigs failed and reinforced Castro's standing at home and abroad.
In October 1962, Washington and Moscow nearly came to nuclear war over Soviet missiles stationed in Cuba.
Ever defiant toward his neighbor just 90 miles (145 km) to the north, Fidel Castro, 88, remained in power until 2008, when he handed off to his younger brother Raul Castro, 84.
(Reporting by Daniel Trotta in Havana and Jeff Mason, Roberta Ramptonm Matt Spetalnick and Lesley Wroughton in Washington; Editing by Doina Chiacu and Lisa Von Ahn)