Taylor Swift is safe from a stalker who allegedly threatened to "kill any man" who came between him and the singer -- a judge just ordered him to stay 100 yards away from her for the next 3 years.
TMZ broke the story ... Swift obtained a temporary restraining order earlier this month against Timothy Sweet, who allegedly believes he's married to the singer. Swift claims Sweet vowed to murder anyone who came between them, including Secretary of State John Kerry.
The temporary restraining order was extended Tuesday to 3 years. Sweet is also forbidden from going near Taylor's parents.
Swift claims Sweet has harassed her since January 2011 ... bombarding her with emails, letters, and social media posts professing his love for her.
You might say ... she knew he was trouble.