Madrid (CNN) -- Soccer star Lionel Messi and his father testified in a Barcelona court Friday in a preliminary hearing over allegations they defrauded Spanish tax authorities of more than $5 million.
Prosecutors filed charges last June. Messi has denied any wrongdoing, and last August he and his father paid $6.75 million in back taxes plus interest.
But a prosecution spokesman told CNN by phone that they still had to appear in court because they are potentially liable, if the matter goes to trial and they are convicted, to pay a fine of $10 million to $32 million and could be sentenced to up to four years in jail.
The complaint centers on alleged tax fraud during 2007, 2008 and 2009. Prosecutors contend Messi and his father, aiming to lower their Spanish tax bill, sought to manage the player's lucrative income from image rights through shell companies set up overseas.
Messi, 26, has a yearly salary from his club, FC Barcelona, of just over $20 million plus around $21 million in endorsements from sponsors including Adidas and PepsiCo.
"We have always fulfilled all our tax obligations, following the advice of our tax consultants, who will take care of clarifying this situation," Messi posted on his Facebook page last June.
His father, Jorge Horacio Messi, was first to arrive on Friday at a court in Gava, a Barcelona suburb chosen because the soccer star's home is within its jurisdiction.
Messi, a four-time world player of the year, arrived later and video images of the scene showed a crowd gathered to cheer on, and seek autographs from, the star who's helped FC Barcelona stay atop the Spanish league standings this season.
The closed-door hearings were held before an investigating magistrate and included prosecutors, the Messis and their lawyers, and a lawyer for Spain's tax authority, said the prosecution spokesman.
Messi testified for about 30 minutes and his father, for about an hour, earlier and separately, said Gemma Linan, a reporter for CNN affiliate 8tv, who was outside the courthouse.
After the hearings, the lawyer for the Messis, Cristobal Martell, spoke briefly to reporters, promising total transparency and a willingness to collaborate and make sure taxes are paid, and adding that there had been no intent to defraud.
"We were told to do only one thing: to collaborate with the administration to clear up the facts showing the economic data," Martell said, according to a translation by Reuters. "The order we were given by the Messi family was to show transparency, clarity and collaboration. We proceeded as we did today with the only goal of showing transparency, and we have proven little aim for fraud and a clear will to regulate the situation with the State Agency for Tax Administration, in order to avoid any big fight with the state regarding the fiscal ruling."
The prosecution spokesman, who by custom is not identified, said that last Wednesday, just two days before the hearing, Martell tried to reach an out-of-court settlement with prosecutors for the Messis.
Prosecutors proposed that both Messi and his father would plead guilty to tax evasion in the hearing, and would likely be fined about $10 million and receive a one-year sentence, which would not require time in prison because they have no prior convictions, the spokesman said.
But Martell said the Messis were opposed. He proposed that only the father would make such a plea, in exchange for prosecutors and the court relieving Leo Messi of any responsibility. Prosecutors would not accept that based on Spanish law, the spokesman said.
Inside the court, Messi's father testified that he was in charge of the finances, and any blame would be his, and Lionel Messi was not involved, according to a prosecutor who talked to an ad hoc pool of Spanish journalists, Linan said.
Messi, who arrived at Barcelona as a 13-year-old in 2000, has won six Spanish Primera Liga titles and three Champions League crowns and scored an unparalleled 86 goals for the club and his national team, Argentina, in 2012.
FC Barcelona has refused comment on the case.