BARCELONA, Spain — Barcelona star Lionel Messi and his father can avoid prison for tax fraud by paying an extra fine, a Spanish court said Friday.

Instead of Messi serving his 21-month sentence, the Argentina forward will be fined an extra €252,000 ($287,000).

The Barcelona-based court also ruled that Messi’s father, Jorge Horacio Messi, will be fined an extra €180,000 ($205,000) instead of serving his 15-month sentence.

The ruling was widely expected in Spain, where prison sentences under 24 months for first-time offenders can be waived by a judge.

Last year, a court found Messi and his father each guilty of three counts of defrauding tax authorities of 4.1 million euros ($4.6 million) from 2007-09. The unpaid taxes were from money made through endorsement deals, not Messi’s salary paid by Barcelona.

In that ruling Messi was also fined 2 million euros and his father 1.5 million euros. Both were originally sentenced to 21 months, but his father’s sentence was later reduced to 15 months.