The daylong visit included a meeting with the members of the Bosnia-Herzegovina presidency at the presidential palace, and an open-air Mass at a stadium which tens of thousands of joyful worshipers attended.
Bosnia has faced past tensions among Muslims, Catholics and Orthodox Christians. Two decades ago, ethnic and religious hatred raged during the nearly four-year siege of Sarajevo in the 1990s. Up to 150,000 are estimated to have died in the war, many of them in ethnic cleansing, a term first coined in the Bosnian conflict.
The Pope was greeted with cheers and applause as he moved through the crowds at the stadium in an open-sided "popemobile" ahead of the Mass.
In his homily, he spoke of the suffering, misery and destruction brought by war -- and urged all those there to work toward peace, despite the efforts of those who seek to foster conflict for their own gains.
"Even in our time, the desire for peace and the commitment to build peace collide against the reality of many armed conflicts presently affecting our world," he said.
"They are a kind of third world war being fought piecemeal and, in the context of global communications, we sense an atmosphere of war."
The people of Sarajevo know well what pain war can bring, he said. "Today, dear brothers and sisters, the cry of God's people goes up once again from this city, the cry of all men and women of good will: war never again!"
'The Jerusalem of Europe'
Pope Francis lunched with Bosnia's bishops before traveling on in the popemobile, through streets lined with waving and cheering supporters, to the capital's imposing Sacred Heart Cathedral.
There he was greeted by the archbishop for Sarajevo, Cardinal Vinko Puljic, and other Roman Catholic figures, before hearing accounts of wartime suffering from a priest and members of religious orders.
At the cathedral, Pope Francis abandoned his prepared speech and spoke of the importance of remembering the country's suffering to forge a lasting peace. He talked about forgiveness and the lessons of history.
"You have no right to forget your story," he said. "Do not take revenge, but make peace."
After two priests and a nun recalled the torture and abuses suffered in the war, Pope Francis urged the gathered priests and nuns to never lose sight of the cruelty of those years.
"In your blood, in your vocation, there is the blood of these three martyrs," he said. "Think of how much they suffered."
Later, the Pope attended an interfaith gathering at the International Student Center in Sarajevo that he called a "sign of a common desire for fraternity and peace."
A city that was once a symbol of war and destruction has become a place where diversity no longer represents a menace but a sign of richness and opportunity, Pope Francis said.
Addressing political leaders at the presidential palace earlier, ahead of the Mass, Francis recognized the capital's difficult journey toward peace.
"I am pleased to be in this city which, although it has suffered so much in the bloody conflicts of the past century, has once again become a place of dialogue and peaceful coexistence," he said.
He highlighted the mix of distinct religious, ethnic and cultural groups that have led some to call Sarajevo "The Jerusalem of Europe," saying it "represents a crossroads of cultures, nations and religions, a status which requires the building of new bridges, while maintaining and restoring older ones."
And he said steps to extend peace and good relations among Croats, Serbs and Bosnians, as well as Muslims, Hebrews and Christians, took on a significance beyond the country's borders.
"These initiatives offer a witness to the entire world that such cooperation among varying ethnic groups and religions in view of the common good is possible; that a plurality of cultures and traditions can coexist and give rise to original and effective solutions to problems; that even the deepest wounds can be healed by purifying memories and firmly anchoring hopes in the future," he said.
During his visit, the Pope will drive through a historic center that includes cemeteries for some of the victims of the conflict. He'll also meet youth from across all religions and leaders of Muslim, Christian Orthodox and Catholic faiths.
Many will hope that in his meeting with political leaders, Francis was able to send the message that for the country to move forward, issues of corruption and high unemployment must be tackled.
Security was tight in Sarajevo ahead of his arrival, with a heightened police presence. Roads were closed and cars cleared from the streets along the pope's route.
The estimated tens of thousands who gathered for the Mass at the Kosevo Stadium also went through security screening including bag checks.
Security concerns have been heightened since a police officer was killed in April in the town of Zvornik, in what authorities said was a suspected terrorist attack
Following in John Paul II's footsteps
This is not the first time a head of the Roman Catholic Church has made a stop in Bosnia.
Pope John Paul II visited Sarajevo in 1997 in a trip that made headlines long before his plane landed.
Shortly before the Pope arrived
, police found mines, plastic explosives and detonators under a bridge on which John Paul's motorcade was to pass on its way from the airport. Authorities removed them before his arrival.
He also traveled just over a year ago to Jerusalem, Tel Aviv and the West Bank city of Bethlehem, where he met with Israeli and Palestinian political leaders, as well as top religious figures.