The men, from Tunisia and Palestine and homeless in Rome, allegedly tried to snatch the soldiers' machine guns outside Santa Maria Maggiore cathedral, while shouting “Allah (God) is great”, Il Messaggero reported.
The soldiers were among the hundreds deployed to patrol the capital in the wake of the Paris terrorist attacks in November.
The men, aged 30 and 40, also tried to canvass the help of others in their quest to disarm the officers.
They were arrested and taken to a police station, where they are said to have spoken out against law enforcement and Europe, in both Italian and Arabic.
It was also revealed that previous deportation orders had been issued to them both.
The pair were charged with resisting and threatening an officer, as well as incitement to commit a crime for terrorism purposes.
They were given another deportation order and sent to a refugee centre near Bari while they await expulsion from Italy.