They told reporters in the southern city of Bari that the man, identified as Omar Moshin Ibrahim, was detained last Thursday and that a magistrate had charged him on Monday with instigating terrorism and supporting terrorism.
Police said Ibrahim was stopped following a month-long surveillance operation as he was about to leave Bari where he worked for a cleaning company.
The investigation, the police officials said, included wiretaps in which Ibrahim was heard telling someone, "Let's put bombs in all the churches of Italy. Where is the largest church? It is in Rome."
In another conversation, they said, he was heard praising those who "killed on the path of Allah" and hailing last week's shooting at the Strasbourg Christmas market in which a gunman killed five people.
Police added that the man used the alias of Anas Khalil and called himself "Yusuf" on social media, and had arrived in Italy in 2016. He was suspected of having been a militant of Islamic State previously.
Italian police have increased security around churches, including St. Peter's, ahead of Christmas, which draws big crowds to the Vatican area.