Conservatives are furious with the socialist government for negotiating with Catalonia's separatist executive as Madrid tries to ease tensions with the north-eastern region after a secession attempt in October 2017.
The separatists want Sanchez to agree to talks on self-determination for their region, but the government argues that Spain's constitution doesn't allow it. "It [self-determination] is a synonym of peace, not of war", Andreu Van den Eyndehe told the court.
In his opening remarks to the trial, which is being transmitted live on national television, a lawyer defending two of the accused said they had the right to seek independence for their region.
Sanchez could be forced to call an early election if the Catalan separatists, whose support brought the Socialists to power a year ago, don't change their current position of voting against his spending plan Wednesday. The declaration was based on the results of a divisive secession referendum that ignored a constitutional ban.
Supporters of the defendants, who face up to 25 years in prison if convicted, say they are political prisoners and the trial itself is political.
Carles Puigdemont, Torra's predecessor who fled from Spain, called for the 12 separatists to be absolved for their alleged crimes and called the trial "a stress test for the Spanish democracy".
Raul Romeva, one of nine defendants jailed without bail since late 2017 facing the charge of rebellion, has made clear his view that it should end only with an acquittal.
Spain's Prime Minister Pedro Sanchez arrives at the Spanish parliament in Madrid, Wednesday, Feb. 13, 2019.
The government rejects this, saying the defendants have broken the law and judges are handling the case without political interference, in line with the rule of law.
Puigdemont said all democracies around the world should be inspired "by the Catalan struggle for democracy and the image of our civil and political leaders on trial concerns all of (those) who believe in a stronger democracy".
Sanchez's socialist PSOE party holds less than a quarter of seats in parliament and needed support from the smaller regional parties to get the budget passed.
"If there is no budget, it won't be the Catalan pro-independence parties' fault, it will be because you think you will benefit from an early election", said Ferran Bel, from the Catalan PDeCat party, addressing the government.
In a tweet, Sanchez had said he expected both right-wing and pro-independence lawmakers to vote against his budget. "They both want the same: A divided Catalonia and a divided Spain. We are working for a Catalonia in peace and a united Spain", he said.
Secessionists have called on Catalans to briefly stop work at midday on Tuesday to protest against the trial and join a rally in Barcelona in the evening. Another big demonstration is planned for Saturday and a general strike on February 21. But the move backfired as the secessionists retained a slim majority in the Catalan assembly.
The trial is expected to last at least three months, with a final ruling not before June.