Pope Francis has told worshippers in a mosque in the Central African Republic that "Christians and Muslims are brothers and sisters".
He was speaking to Muslims who had sought shelter in the capital Bangui after nearly three years of violence between Christians and Muslims.
The mosque visit was seen as perhaps the most difficult part of his Africa tour, a BBC correspondent says
Pope Francis then held the final Mass of his Africa trip in Bangui.
He was speaking in Latin, which was then translated into the local Sango language.
His message of reconciliation appeared to have an immediate impact, as a reporter from the AFP news agency spotted a group of Muslim rebels turn up at the Mass wearing t-shirts with the Pope's image on them.
The Pope has now left the CAR at the end of his six-day visit to the continent.
More than 100,000 Muslims fled the capital as a result of the fighting but 15,000 are left in an area called PK5, according to the campaign group Human Rights Watch.
Imam Tidiani Moussa Naibi thanked the Pope for his visit and said it was "a symbol which we all understand", the AP news agency reports.
There was tight security for the visit to the Koudoukou mosque and armed UN peacekeepers were stationed on its minarets watching the crowds who had come to greet the pontiff.
On Sunday, the Pope called on fighting factions in the CAR to lay down their weapons.
About half of CAR's population is Christian and 15% Muslim.
Celebrating Mass in Bangui, he said they should instead arm themselves "with justice, love, mercy and authentic peace".
Earlier, he said he hoped next month's election in the CAR would open a "new chapter" for the country.
The trip to the CAR was the pontiff's first visit to a conflict zone and the final stop on his three-nation African tour that also took in Kenya and Uganda.
Conflict has blighted the CAR for decades but it was only in 2013 that the fighting took on a religious form.
President Francois Bozize was ousted in a coup in March 2013 and a group of mostly Muslim rebels from the north, the Seleka, marched on Bangui, briefly taking control of the country.
Their rebellion tapped into a feeling northerners had of being excluded and unrepresented by the central government, correspondents say.
They targeted churches and Christian communities, which triggered the creation of the anti-Balaka - meaning anti-violence - militias, and led to a downward spiral of tit-for-tat violence which continues.
Towns and villages are divided, with hundreds of thousands of people displaced into camps divided along religious lines.
Central African Republic:
- Population: 4.6 million - 50% Christian, 15% Muslim, 35% Indigenous beliefs
- Years of conflict and poor governance
- Conflict only recently along religious lines
- Previously ruled by Emperor Jean-Bedel Bokassa
- Rich in diamonds
- 10,000-strong UN force took over peacekeeping mission in September 2014
- France has about 2,000 troops in its ex-colony, first deployed in December 2013