MADRID — The simmering conflict over Catalan independence roared back to the center of Spanish attention on Tuesday, as 12 people went on trial for their roles in the botched secession attempt of 2017, and Prime Minister Pedro Sánchez scrambled to keep the issue from toppling his government.

The eagerly anticipated trial before the Spanish Supreme Court in Madrid has drawn enormous attention and is being broadcast live on national television, but it could soon be overshadowed by the political crisis unfolding just blocks away, in Parliament.

On Wednesday, Mr. Sánchez’s minority Socialist government faces a crucial parliamentary vote on his national budget. If a majority of lawmakers reject it, including Catalan lawmakers who have so far backed the prime minister, he will almost certainly be forced to call elections.

With Spain’s government hanging in the balance, the Supreme Court is under intense pressure to demonstrate that it can remain impartial and above politics in a case that has ignited passions and recriminations. The Catalan separatist leaders were indicted on charges that include rebellion, after holding an independence referendum and then declaring independence in October 2017 — moves the Spanish courts ruled unconstitutional.