Supreme Court judges have ruled against allowing deposed former Catalan Vice President Oriol Junqueras out of jail.
He faces charges of potential rebellion, sedition and misuse of public funds for going ahead with an illegal independence bid for the region of Catalonia.
In the decision on Friday, the judges said there was a risk that Mr Junqueras might again commit crimes as there was no sign he intended changing his ways.
The politician has previously committed to obey the law if he is released from prison, his lawyers told a panel of judges reviewing his case.
Mr Junqueras has been in jail in Madrid pending trial since 2 November but sought to be released from prison and allowed to resume his political duties.
“I am a man of peace,” Mr Junqueras told judges, according to Spanish media.
Mr Junqueras’ lawyer, Andreu Van den Eynde, said he had vowed to seek negotiations with Spain on the Catalan issue.
“He asked to be freed, to represent the people who voted for him, to be with his family, and to let him manage this situation which demands political maturity,” the lawyer said.
A referendum was held on 1 October 2017 to decide whether Catalonia, an autonomous region of northeastern Spain, should declare itself an independent country.
Catalan officials put the vote in support of independence, vehemently opposed by Spain, at nearly 90 per cent. Turnout however, even by Catalan officials’ estimates, was well below 50 per cent.
The independence campaign catapulted Spain into political turmoil and sparked a mass exodus of businesses and banks from Catalonia to other parts of the country, due to the region’s instability.
The Spanish government responded to the independence drive by enforcing direct rule in the region, removing Mr Junqueras as well as Catalan president Carles Puigdemont and other Catalan politicians.