CALGARY -- A drug deal turned into a carjacking Thursday afternoon, until it was all foiled by a Calgary police dog named Jake.

The events unfolded shortly after 3 p.m., when police were made aware of a drug deal taking place in an alley at 4th Street and 13th Avenue S.W., near the Sheldon Chumir Health Centre.

An offender, male, who is very well-known to police fled the scene, jumping into a truck and driving recklessly through the city, according to a police spokesperson.

Initially, the suspect drove into Marlborough Park, stopping at a residence on Maddock Crescent N.E., all of which was observed from overhead by HAWCS (Helicopter Air Watch for Community Safety).

The suspect dumped the truck and rode off on a motorcycle, driving erratically, hopping onto curbs, before ending up on University and 13th Avenue N.W. in St. Andrew's Heights, near the University of Calgary, all of which was monitored from above by HAWCS.

The motorcycle appeared to run out of gas, prompting the suspect to get off and push it in a futile effort to get it to restart, but it wouldn't.

At that point, the suspect ran up to some people on the street and pointed a loaded gun at them, before carjacking their vehicle.

He got in, where he discovered there were no keys. Then he got out again, and pointed the gun a second time at their heads, demanding keys.

By this time, K-9 was in the area, and officers spotted the suspect.

They released Jake, who set off in pursuit of the suspect, who took off on foot.

There was a brief chase, and then Jake made the collar.

The suspect's name has not been released. There was no word about pending charges.