Miranda Cosgrove is still dealing with her stalker more than 2 years after he was ordered to stay away from her, and now he could be facing prison time ... so say cops.
Law enforcement sources tell TMZ Joshua Stockton was arrested earlier this month for allegedly sending Miranda dozens of ominous emails. We're told the messages weren't threatening, but creepy nonetheless ... calling her a "goddess" and himself a "prince."
We broke the stories ... Stockton was sentenced to probation and treatment after pleading no contest to felony stalking in 2015 after creeping on her at Disneyland -- which violated a previous restraining order she had taken out against him.
After the sentencing, he continued to pursue her online and got sent back to his treatment facility with a stern warning from the judge ... another slip-up could mean 4 years in prison.