Spain's top court has ruled that last year's strict coronavirus lockdown was unconstitutional.
The ruling leaves the door open for people who were fined for breaking the rules to reclaim the money they paid.
But the court said it would not accept lawsuits from people and businesses who want to sue the government because they lost money due to the lockdown.
The government declared a state of emergency on 14 March 2020 to curb the first wave of Covid-19 infections.
At the time, coronavirus cases and deaths were rising and hospitals were quickly becoming overwhelmed. Since then, more than 81,000 people in Spain have died with coronavirus.
Spain has three levels of emergency: state of emergency, state of exception, and the highest level, state of siege.
Under the emergency rules almost all people in the country were ordered to stay at home, and were only permitted to leave for essential reasons. All but essential businesses were closed.
The laws were in place until June 2020, though some restrictions were reinstated later in the year when the country faced a second wave.
But Spain's Constitutional Court said in a statement that it had voted, by a slim majority of six to five, to find that the state of emergency was not enough to give the restrictions constitutional backing.
This is because the rules were equivalent to a suppression of fundamental rights, it said.
In order to legally limit people's freedoms to the extent they did last year, the court said, the government would have had to declare a state of exception rather than a state of emergency.
The ruling was in response to a suit brought by the far-right political party Vox.