The Madrid High Court on Wednesday freed Arnaldo Otegi, leader of the Basque nationalist party Batasuna, after the state prosecutor dropped charges against him.
Otegi was brought to Madrid earlier by plane after being arrested by hooded police, as he refused to make it to a court hearing because the roads were blocked by snow.
The court on Wednesday dismissed the case against Otegi after the prosecutors, who had been demanding a jail term of 15 months for him, decided to drop the charges of "glorifying terrorism" against him.
Addressing the court, the prosecutor acknowledged that it was "very doubtful" that the accusation against Otegi amounted to an "apology for terrorism."
Otegi had expressed "his convictions in a complacent manner, but his discourse did not go beyond expressing an opinion that was possibly contentious but not criminal," the prosecutor said.
The case stemmed from remarks Otegi made at the funeral of 22-year-old Olaya Castresana, a suspected member of the Basque separatist group ETA who died in 2001 while handling an explosive device. At the funeral, Otegi praised fallen ETA members as patriots.
Otegi is embroiled in a series of legal cases related to his activities with Batasuna, banned in 2003 over its links with ETA. In April 2006, he was tried because he paid homage to ETA member Jose Miguel Banaran on the 25th anniversary of his death.