VATICAN CITY (Reuters) - U.S. presidential candidate Bernie Sanders, addressing a Vatican conference on social justice on Friday, decried the “immoral” gap between the world’s rich and poor that he said was worse than a century ago.

The Democratic hopeful from Vermont has campaigned on a vow to rein in corporate power and level the economic playing field for working and lower-income Americans who he says have been left behind, a message echoing that of Pope Francis.

The trip is inconveniently timed for 74-year-old senator, coming four days before a Democratic party primary in New York. A loss there would blunt his momentum after winning seven of the last eight state contests and give front-runner Hillary Clinton a boost in her drive to the party’s presidential nomination.

Sanders said in his speech to the Pontifical Academy of Social Science that the Roman Catholic Church’s first encyclical on social justice, written in 1891 by Pope Leo XIII, lamented the enormous gap between the rich and the poor.

“That situation is worse today. In the year 2016, the top 1 percent of the people on this planet own more wealth than the bottom 99 percent,” the self-described democratic socialist said.

“At a time when so few have so much, and so many have so little, we must reject the foundations of this contemporary economy as immoral and unsustainable,” he said.

Sanders, the Brooklyn-born son of Polish Jewish immigrants, has said the trip was not a pitch for the Catholic vote but a testament to his admiration for Pope Francis, whom he is not expected to see during his flying visit.

Slideshow ( 13 images )

He will be back on the campaign trail on Sunday.

CHANTS OF “BERNIE, BERNIE” AT VATICAN GATE

After reading the speech in the academy building inside the Vatican grounds, Sanders walked outside one of the city-state’s gates to talk to reporters and was greeted by chants of “Bernie, Bernie, Bernie” from a vocal group of local supporters.

Pope Francis sent a message to the academy, saying he had wanted to meet the conference participants in the evening, but could not because he is leaving Rome early on Saturday to visit refugees on the Greek island of Lesbos.

Saying he was “proud and excited to be here”, Sanders praised the pope’s visionary views about creating “a moral economy, an economy that works for all people and not just for the people on top”.

Reflecting the themes of his campaign, he said he and the pope both agreed that “we’ve got to ingrain moral principles into our economy and there is no area where that is clearer than the area of climate change. The greed of the fossil fuel industry is literally destroying our planet”.

Slideshow ( 13 images )

Pope Francis wrote a major encyclical, or papal treatise, last year on the need to respect the environment.

In other parts of his speech, Sanders decried “reckless financial deregulation,” including rules on political party financing, that he said had “established a system in which billionaires can buy elections” in exchange for laws that would make them only richer.

“Rather than an economy aimed at the common good, we have been left with an economy operated for the top one percent, who get richer and richer as the working class, the young and the poor fall further and further behind,” he said.

Sanders will spend less than 24 hours in Rome before returning to the campaign trail before the New York primary on Tuesday.