ATLANTIC CITY, N.J. (CBS) – Three teens were arrested after police say they stole their teacher’s car and went on a joyride.

It happened around 5 p.m. Thursday at the New York Avenue School in Atlantic City.

Atlantic City police say the students were able to remove the key from the teacher’s keychain before going on the joyride.

Police were able to track the vehicle’s location with the help of the Mercedes Benz Corporation.

“Upon seeing Officer Rex’s patrol vehicle the three males immediately fled the area. Officer Rex chased and arrested a 16-year-old male. Detective Garry Stowe chased and arrested a 17-year-old male,” police said in a news release.

Police say Detective Stowe located several bags of marijuana in the 17-year-old’s pocket.

The 13-year-old boy, who police say drove the car, was also arrested.

All three are facing charges of joyriding, possession of a controlled dangerous substance and other related offenses.

The teens were released to their parents.