PANAMA CITY — The leaders of the United States and Cuba held their first formal meeting in more than half a century on Saturday, clearing the way for a normalization of relations that had seemed unthinkable to both Cubans and Americans for generations.

In a small conference room in a Panama City convention center, President Barack Obama and Cuban President Raul Castro sat side by side in a bid to inject fresh momentum into their months-old effort to restore diplomatic ties.

Obama said he wanted to “turn the page” on old divisions, although he acknowledged that significant differences between the governments would remain.

“This is obviously a historic meeting,” Obama said shortly after the two sat down. “It was my belief it was time to try something new, that it was important for us to engage more directly with the Cuban government.”

“And more importantly, with Cuban people,” the president added.

Castro told the U.S. president he was ready to discuss sensitive issues including human rights and freedom of the press, maintaining that “everything can be on the table.” But he also cautioned that the two countries also have “agreed to disagree.”

“We are willing to make progress in the way the president has described,” Castro said.

The remarkable gathering played out on the sidelines of the Summit of the Americas, which this year included Cuba for the first time.

Although the meeting wasn’t publicly announced in advance, White House aides had suggested the two leaders were looking for an opportunity to meet while in Panama and to discuss the ongoing efforts to open embassies in Havana and Washington, among other issues.

In brief remarks to reporters at the start of the meeting, Obama acknowledged that Cuba, too, would continue raising concerns about U.S. policies. Earlier in the day, Castro launched into an exhaustive history of perceived Cuban grievances against the U.S. in his speech to fellow leaders attending the summit.

Castro, for his part, said he agreed with everything Obama had said — a stunning statement in and of itself for the Cuban leader.

“We are disposed to talk about everything — with patience,” Castro said in Spanish. “Some things we will agree with, and others we won’t.”

And nothing is static, he added, noting that disagreements today could turn into areas of agreement tomorrow.