The 66-year-old suspect had expressed anger at Spain's decision to exhume the remains of former dictator Francisco Franco.
A man has been sentenced to seven-and-a-half years in prison for threatening to kill Spanish Prime Minister Pedro Sánchez.
Manuel Murillo Sanchez was found guilty by Spain's National Court of preparing to commit assassination and illegal weapons offences.
The 65-year-old former security guard from Tarrasa was arrested in 2018 after making deaths threats in a WhatsApp group.
The court heard how Murillo Sanchez had offered to act as a "sniper" and "hunt down" the Spanish PM "like a deer".
The suspect's comments came after the Spanish government had ordered for the remains of former dictator Francisco Franco to be exhumed.
The court rejected his defence that he had been intoxicated when sending the WhatsApp messages and sentenced him to two years and six months in prison for attempted murder.
He was also given a five-year sentence for possessing illegal weapons and banned from owning any firearms for eight years. The verdict is subject to appeal.
The remains of Franco were removed to a cemetery on the outskirts of Madrid in October 2019, prompting anger from far-right groups in Spain.
In a WhatsApp group, Murillo Sanchez had allegedly told fellow users that he was a "sniper with a precise shot" who could target Prime Minister Sanchez.
"We cannot allow them to humiliate Generalissimo Francisco Franco ... If necessary, I will go armed and sit on Franco's tomb, and if they come close, I will shoot", he reportedly wrote.
The court said the man's "determination" and the number of weapons seized from him shows "a high level of danger" even if he had not made any specific plans to kill the Spanish PM.
The suspect had repeatedly expressed "his intention to finish off the president of the government" to "bring about a change in the Spanish political situation", a court statement read.