MILAN, Italy - A court on Tuesday ordered former Prime Minister Silvio Berlusconi to serve a tax fraud sentence by doing community service with the elderly, in a ruling that restricts his movements but not his political activity.

The court ruled that Berlusconi, one of Italy's richest men, must spend four hours a week in a Catholic retirement home on the outskirts of Milan for a year. The home's director said the media tycoon would keep residents company and take them to Mass.

The four-time prime minister, 77, will not be allowed to travel outside Lombardy, the region around Milan where he has his main residence, except for restricted trips to Rome.

However, Berlusconi's allies said he would still be able to campaign for next month's European Parliament election and play a political role. The ruling does not mention any restrictions on holding political rallies or giving interviews.

Following a definitive tax fraud conviction last year, Berlusconi was stripped of his seat in the Italian Senate and barred from holding public office for two years.

But he remains the most influential politician on Italy's center-right as leader of the Forza Italia party.

A court statement said the trips to Rome could take place weekly, from Tuesday to Thursday, with Berlusconi ordered to be back at his Lombardy residence by 11 p.m. each Thursday. Berlusconi is expected to begin his community service duty by the end of the month.

His lawyers Franco Coppi and Niccolo Ghedini said in a statement that the ruling "appears balanced and satisfactory even with regards to the needs of political activity," and political allies said they were pleased with the decision.

"Berlusconi will take part in the electoral campaign," said his aide, Giovanni Toti. Another ally, Raffaele Fitto, said the ruling was nonetheless "a deep wound for Italian democracy."

Milan prosecutors did not press for house arrest and agreed with Berlusconi's attorneys to ask for community service.

Berlusconi, who is also appealing a conviction for paying for sex with an underage prostitute, has dominated Italian politics since the mid-1990s, repeatedly escaping punishment in criminal cases he said were engineered by political foes.

That run came to an end in August, when he was finally convicted of masterminding a complex system of tax fraud at his Mediaset television network.