A 22-year-old California man was sentenced to 66 months in federal prison on Monday after cyberstalking and threatening to kidnap relatives of those killed in the 2018 mass shooting at Marjory Stoneman Douglas High School in Parkland, Fla., federal prosecutors said.

The man, Brandon Michael Fleury, impersonated the confessed gunman on social media for three weeks to threaten and taunt survivors of the shooting and victims’ loved ones. He was found guilty in October of three counts of cyberstalking and one count of transmitting a kidnapping threat.

Sabrina Puglisi, Mr. Fleury’s lawyer, said she was disappointed that the judge did not place Mr. Fleury in a residential treatment program, given that he has autism spectrum disorder. However, she said, she was pleased the judge’s sentence was much lower than the maximum 20 years that Mr. Fleury had faced.

“The judge made a strong argument that this type of trolling behavior on the internet is not OK, not acceptable and it won’t stand,” Ms. Puglisi said in an interview on Monday. “He wanted to send a message to deter people from doing the same.”