“Anybody can walk into St. Peter’s Square — that’s the whole point of it,” said Dr. Mannion. “It was designed to be welcoming and to draw people in like two open arms, to draw them into the heart of the church.”

Some of the walls in Vatican City were built in the ninth century by Pope Leo IV in an attempt to protect it from attacks by pirates and other marauders, historians said. But other stretches of wall were built during the 15th and 16th centuries, Dr. Mannion said, less as a defensive measure and more as “a political and cultural statement” about the cultural and political power of the pope.

Today, the public can freely enter some parts of Vatican City, including St. Peter’s Basilica, St. Peter’s Square and the Vatican Museum (which charges for the price of a ticket). Those areas receive millions of visitors each year who are able to enter and exit the tiny city-state as they wish.

Areas of the Vatican that are involved in the day-to-day governance of the church or that house officials, like the pope himself, are more difficult to gain access to, said Diane Apostolos-Cappadona, also a Catholic studies professor at Georgetown.

“That’s the same as any government structure in the world,” she said. “You can’t just walk into the White House.”

Gaining access to some parts of the Vatican, such as the library or the archives, is more complicated than just strolling into St. Peter’s Square. But the process does not appear to be too cumbersome.

Ken Pennington, a professor of medieval history at the Catholic University of America, in Washington, said his research on canon law had brought him into the Vatican many times over the past four decades.