VATICAN CITY — The Vatican tribunal on Saturday convicted a former Holy See diplomat and sentenced him to five years in prison for possessing and distributing child pornography in the first such trial of its kind inside the Vatican.

Monsignor Carlo Capella admitted to viewing the images during what he called a period of “fragility” and interior crisis sparked by a job transfer to the Vatican embassy in Washington. He apologized to his family and the Holy See, and appealed for leniency by saying the episode was just a “bump in the road” of a priestly vocation he loved and wanted to continue.

Tribunal President Giuseppe Dalla Torre read out the verdict after a two-day trial and sentenced Capella to five years and a fine of 5,000 euros ($5,830.) Capella will serve the sentence in the Vatican barracks, where he has been held since his arrest earlier this year.

Prosecutor Gian Piero Milano had asked for a stiffer sentence due to what he called the “great” amount of material accessed, which included 40 to 55 photos, films and Japanese animation found on his cellphone, an iCloud and Tumblr account, which Capella viewed even after he had been recalled by the Vatican in August 2017.

Prosecutors and Vatican investigators said the material featured children aged 14-17 engaging in sexual acts.

Capella’s attorney disputed that Capella had distributed the material. He denied the amount of porn was excessive, and said his client had cooperated with investigators, repented and was seeking psychological help.

The Vatican recalled Capella, the No. 4 official in its Washington embassy, after the US State Department notified it in August of a “possible violation of laws relating to child pornography images” by one of its diplomats in Washington.

Soon after, Canadian police issued an arrest warrant for Capella, accusing him of having accessed, possessed and distributed child porn over Christmas 2016 from a church in Windsor, Ontario, using a social networking site.

His recall was immediately denounced by US Catholic bishops who, still stinging from the fallout of the clerical sex abuse scandal, saw it as an attempt by the Vatican to shield one of its own. But all along the Vatican insisted it would prosecute Capella, who was subject to the Vatican tribunal’s jurisdiction even though his crimes also occurred elsewhere.

The trial was the first known enforcement of a 2013 law for the Vatican City State that specifically criminalized possession and distribution of child pornography, punishing it with up to five years in prison and a 50,000 euro fine.

Now that the criminal prosecution is over, Capella will be subject to a canonical trial, which could result in him being defrocked.

It wasn’t immediately clear if Canadian authorities would pursue their case against him; the Vatican doesn’t extradite its citizens.

Capella said he realized that his actions were vulgar and “improper.” During a final statement Saturday begging for the minimum sentence, Capella apologized for the pain his “fragility” and “weakness” had caused his family, his diocese and the Holy See.

“I hope that this situation can be considered a bump in the road” and that the case could also could be useful for the church, he said.

Capella was a high-ranking priest in the Vatican’s diplomatic corps. He served on the Italy desk in the Vatican’s secretariat of state and was part of the official delegation that negotiated a tax treaty with Italy before being posted to the US embassy in 2016.

A canon lawyer, Capella is listed online as having written a 2003 paper for the Pontifical Lateran University on priestly celibacy and the church’s criminal code.

The case was similar to the 2013 recall of the Vatican’s then-ambassador to the Dominican Republic, Monsignor Jozef Wesolowski, who was accused of sexually abusing young boys on the Caribbean island.

Wesolowski was defrocked by the church court, but he died before the Vatican’s criminal trial got underway.