VATICAN CITY — Chancellor Angela Merkel of Germany said on Saturday that Pope Francis had encouraged her to work to preserve the Paris climate accord despite the United States’ decision to withdraw and that he shared her aim to “bring down walls,” not build them.

Ms. Merkel met with the pope for about 40 minutes on Saturday in the Apostolic Palace, focusing on a Group of 20 summit meeting that Germany will host in Hamburg from July 7-8.

The Vatican said the talks focused on the need for the international community to combat poverty, hunger, terrorism and climate change.

Ms. Merkel told reporters she had briefed the pope on Germany’s Group of 20 agenda, which she said “assumes that we are a world in which we want to work together multilaterally, a world in which we don’t want to build walls but bring down walls.”