A purported Gangster Disciple was sentenced to 40 years in prison Thursday after admitting he shot and killed a 13-year-old boy at an Uptown pizzeria.

Andre Alejandro, 25, pleaded guilty to the 2012 murder before Cook County Judge Thomas Gainer, according to court records.

Ivan Alanis was eating pizza with his sister and her friend when he was shot in the mouth at Laurie’s, in the 5100 block of North Broadway.

Alejandro thought the trio were rival gang members, and after exchanging words and flashing gang signs with one of them through the door, he fired three times and struck Ivan.

Just four years before murdering Ivan, Alejandro and his friends severely beat a rival at the same pizzeria, sending the victim to the hospital for nearly 50 stitches.

Ivan, an Armstrong Elementary School student, was the youngest of nine siblings and was not in a gang, his family said at the time of his death.

Email: rhussain@suntimes.com

Twitter: @rummanahussain