McKINNEY, Texas (CBSDFW.COM) – The Collin County District Attorney announced a plea deal in the case of a Plano teenager charged with plotting an ISIS inspired terror attack.

Matin Aziz-Yarand was sentenced to 20 years in prison.

The terror plot was planned for last May at a Frisco mall before it was thwarted by an undercover FBI agent.

Azizi-Yarand appeared in shackles and a yellow jail issued jumpsuit when the 19-year-old entered a Collin County courtroom and admitted guilt before a judge.

Afterward, federal and state prosecutors announced the plea deal during a news conference.

“This was a textbook case of joint investigation and prosecution that absolutely saved lives,” says Collin County District Attorney Greg Willis.

Azizi-Yarand is a former Plano West Senior High School student who plotted a mass shooting at Frisco’s Stonebriar Centre and other places.

In disturbing online exchanges with an undercover FBI agent, the teenager wrote, “School is a perfect place for an attack. Crowded and close quarters…Even a blind man could take 10 easily. Just fire where you hear screams.” as well as “I’d actually like to make a cop surrender and drop his gun…Then, douse him with gasoline and burn him. Record it.”

“This was no distant dream for this young man, this was a well planned out, well developed imminent plan,” says Joe Brown, U.S. Attorney for the Northern District of Texas.

Defense attorneys concede that a guilty verdict was likely.

“We thought it was in the best interest of our client he was facing life in prison, 20 years is a very reasonable deal on this case,” says Mitch Nolte, defense attorney.

The case became complicated for authorities because the teenager was too young to face federal terrorism charges but there was no state law about abetting foreign terrorists.

Because Azizi-Yarand threatened to kill mall security, he could be charged with solicitation of capital murder.

“This case underscores the need for the Texas Legislature to make material support of a foreign terror organization a state crime as well,” says Willis, “If we had that law in Texas that would’ve fit this crime better than the laws that we used.”

Yarand will have to serve 10 years before he’s eligible for parole.

RELATED STORY

Arrest Affidavit: Plano Teen Plotted ISIS-Inspired Attack For Months