U.S. President Barack Obama announced a historic shift in foreign policy on U.S.-Cuba relations Wednesday via executive authority. But secret talks between the United States and the island nation have been ongoing for more than a year. In fact, Obama’s plan to reopen the door to Cuba began before he even took office, when he was a presidential candidate.

Obama voiced a desire to reach out to the Cuban people during his 2008 presidential campaign. Republican challenger and Arizona Senator John McCain criticized Obama’s pledge to meet Cuban President Raúl Castro, “at a time and place of my choosing.” Obama said that if Cuba released all U.S. political prisoners and took steps toward democracy, “we will take steps to begin normalizing relations,” according to the New York Times.

Shortly after Obama took office, the president announced a string of policy changes with Cuba in April 2009 that lifted all restrictions on family visits to Cuba, removed restrictions on remittances to family members in Cuba, authorized greater telecommunications links and revised gift parcel regulations to expand the scope of humanitarian donations eligible for export.

But the December 2009 imprisonment of American government subcontractor Alan Gross in Cuba posed a major obstacle for making further progress. Gross was arrested while trying to install Internet access in Cuba for the U.S. Agency for International Development. He was tried and sentenced to 15 years in prison because Cuba considers USAID’s democracy-promotion programs illegal attempts to destabilize its government.

The next indication of any progress in U.S.-Cuba relations was a brief handshake between Obama and Castro at Nelson Mandela’s funeral in South Africa in December 2013, the New York Times reported. But secret talks with Cuba had already begun earlier that year with the support of the Vatican and the Canadian government, CNN reported. The Vatican may have been involved as early as March 2012, according to the Chicago Tribune, when U.S. lawmakers sought help from the papal ambassador’s office in Washington, D.C.

Obama is no stranger to covert dialogues. Secret talks between the United States and Iran helped lead to the interim nuclear deal in November 2013. The Obama administration held secret talks this year with Iran, and Obama has written multiple letters to Iran’s Supreme Leader Ayatollah Ali Khamenei, stressing a comprehensive agreement with global powers on Tehran’s disputed nuclear program.

Pope Francis has played a key role in reestablishing diplomatic relations between the United States and Cuba, since succeeding Pope Benedict XVI in March 2013. Francis, the first Latin American pontiff, sent letters to Obama and Castro this summer urging the two leaders to reconcile differences, Obama said in his national address Wednesday. The letter, which also included an appeal to release Gross and three Cubans detained in the United States, “gave us greater impetus and momentum for us to move forward,” U.S officials told the Associated Press.

Obama and Castro spoke on the telephone Tuesday for almost an hour; it was the culmination of 18 months of covert talks, resulting in the deal announced Wednesday that settles the decadeslong stalemate between the two countries and frees Gross from a Cuban prison. The telephone call also marked the first presidential call between the two nations since the 1959 Cuban revolution, according to the Associated Press.

“Neither the American nor Cuban people are well-served by a rigid policy that is rooted in events that took place before most of us were born,” Obama said in a televised address Wednesday. “Today, America chooses to cut loose the shackles of the past.”