Before he gets to Philadelphia and New York City in September, Pope Francis will visit Cuba, the Vatican said on Wednesday.

The visit, en route to the United States, will cap his success in bringing the former enemies together after more than half a century of distrust.

Vatican spokesman Father Federico Lombardi did not specify how long the stop in Cubawould last, saying only that Francis had accepted invitations made by the Cuban government and the Cuban Roman Catholic Church.

It will be the Argentine pope's first visit to Cuba as pontiff. Both his predecessors, John Paul II and Benedict XVI, visited the island and met revolutionary leader Fidel Castro.

Last December, Havana and Washington announced after 18 months of secret diplomacy brokered by the pope's diplomats and Canada that the two sides were working to re-open embassies in their respective capitals.

"Both President Raul Castro and President Obama recognized and explicitly thanked the Holy Father for his gesture," Monsignor Jose Felix Perez of the Cuban Catholic Bishops' Conference, told Reuters in Havana.

"His mediation, without a doubt, was effective and in line with the Christian spirit that always brings out reconciliation as the solution to conflicts," Perez said.

Cuba had been a focal point for Vatican diplomats ever since Fidel Castro took power in 1959 and restricted church activities in what was a deeply Catholic country.

The Vatican's opposition to the U.S. embargo over the years gave it credibility with Havana as a diplomatic broker while at the same time it had good relations with a string of U.S. administrations.

U.S. President Barack Obama visited the pope last year and discussed Cuba. Francis later wrote personal letters to Obama and Cuban President Raul Castro urging them to "initiate a new phase" in their relations.

Obama and Raul Castro met on April 11 at the Summit of the Americas in Panama, the first formal face-to-face meeting of the two countries' leaders in more than half a century.

After Pope John Paul visited Cuba in 1998, Francis, who was then a bishop, wrote a book called "Dialogues between John Paul and Fidel Castro" which touched on themes such as family, education, poverty and political ideologies on the island.

The pope is due to arrive in Washington on September 22 and will also visit New York and Philadelphia. He will visit the White House and Congress in Washington and address theUnited Nations in New York.