The spokesman for the banned Basque nationalist party has been detained on suspicion of being a leader of the armed separatist group Eta.
Arnaldo Otegi (right) has called for dialogue between Eta and Madrid
The judge said there was evidence that Arnaldo Otegi's Batasuna group was in a network with Eta.
Mr Otegi, who has been a member of the Basque regional parliament, can be released from prison if he pays a bail of 400,000 euros (£275,266).
Eta are believed to be behind a car bomb attack in Madrid on Wednesday.
Five people were treated in hospital after the blast. It was the seventh explosion blamed on Eta within eight days of the Spanish parliament backing a plan to allow peace talks with the Basque militants if they laid down their arms.
An international arrest warrant has also been issued for one of Mr Otegi's former parliamentary colleagues, Jon Salaberria.
The Basque separatist newspaper, Gara, blamed Spanish Prime Minister Jose Luis Rodriguez Zapatero for what it called a blow to the peace process.
Mr Otegi has previously spent four years in jail for kidnapping. The Batasuna party was banned in 2003 on grounds that it was part of Eta, but Mr Otegi kept his seat in the Basque regional parliament after the party changed its name.
He lost his MP's immunity from prosecution earlier this year when Batasuna candidates were barred from standing in April's regional elections.
Mr Otegi's lawyer said the judge's decision to jail him was a "political and legal scandal".
Batasuna has denied being the political wing for Eta but has refused to condemn attacks by the group.
Last year, Mr Otegi called for peaceful dialogue between all sides to end decades of armed conflict, but he stopped short of making an explicit call for an Eta ceasefire.
Eta's campaign for an independent Basque state since the 1960s has been blamed for about 800 deaths.