By TMZ

Former world champion Sugar Ray Leonard, and his family, say they've been threatened and harassed for years by a man with a violent criminal past, and finally had to get a restraining order.

Leonard was granted protection from Mark Anthony Francisco ... a 55-year-old man who, according to docs, started sending some haunting letters to the boxing legend in 2008. One read, "I will kill you, your mother and your daughters."

He also said, "You need to make a deposit to my checking account before I shoot the s**t out of your ass." And another handwritten letter said, "I mean what the f**k I did and said. I hate a punk ass n***er."

Leonard says Francisco stopped contacting him for several years, but resurfaced in October last year ... when he started repeatedly calling his charitable foundation, and claiming he was Ray's cousin.

He even showed up at Ray's house one day and rang the bell. His wife and daughter greeted him, but just to be safe they told Francisco, Ray didn't live there anymore ... according to the docs. He then sent a letter to Ray saying, "I went to your old houses that you used to live in. See you soon, Mark."

Sugar Ray thinks the guy is mentally unstable and dangerous.

A judge issued an order for Francisco to stay 100 yards away from Ray, his wife and kids.