A California man was sentenced Friday to 20 years in prison for making a hoax 911 call about a hostage situation in Kansas that ended up with police fatally shooting an innocent man.

Tyler Rai Barriss, of Los Angeles pleaded guilty in November to a total of 51 charges stemming from phony emergency calls he made, including one count of making a false report resulting in a death. He admitted to years of "swatting," the act of falsely reporting a serious crime with the aim of drawing a massive police response to the home of an unsuspecting target.

Barriss agreed to serve 20 to 25 years in federal prison as part of a plea agreement, according to the U.S. Attorney's Office in the Central District of Los Angeles.

“We hope that this will send a strong message about swatting, which is a juvenile and senseless practice," said U.S. Attorney Stephen McAllister during a news conference. "We’d like to put an end to it within the gaming community and any other context. Swatting, as I’ve said before, is not a prank."

On Dec. 28, 2017, Barriss contacted police to say he was at a home in Wichita, Kansas, where he said he had fatally shot his father and was holding the rest of the family hostage.

Officers responded to the Wichita address and demanded that anyone inside the McCormick Street home come out.

Confused, Andrew Finch, 28, stepped outside where he raised and dropped his hands several times before an officer opened fire, killing him, officials said.

Barriss called in false report to Kansas police at the behest of two gamers, Casey Viner, 18, and Shane Gaskill, 25, authorities said. Viner asked Barriss to make the call as an act of retaliation against Gaskill after a game of "Call of Duty" ended badly.

Barriss then taunted Gaskill in Twitter direct messages, before Gaskill challenged the California man to swat him, according to court records. Gaskill gave Barriss the address to a home where Gaskill had once lived that was then occupied by Finch's family.

Finch's family is suing the police and the city of Wichita over his death.

Other false calls connected to Barriss between 2015 and 2017 happened in Ohio, Nevada, Illinois, Indiana, Virginia, Texas, Arizona, Massachusetts, MIssouri, Maine, Pennsylvania, New Mexico, Indiana, Michigan, Florida, Connecticut and New York.

The judge on Friday sentenced Barriss to 150 months for the Kansas charges and 90 months for the California charges — both to run consecutively.

He was also sentenced to five years of supervised release for charges in Washington, D.C., for making fake bomb threats to the FBI headquarters and the Federal Communications Commission in 2017. That will run concurrently to the other sentences.

In addition, he has to pay $5,000 of restitution to the Kansas Crime Victims Compensation Board, which paid that amount to the Finch family to cover funeral costs.