Following the death of his master, Constable John Gray, Bobby, a terrier, is entrusted to Ewan, a young man whom Gray had taken under his wing. Despite Bobby and Ewan’s friendship, the dog only ever wants to be beside his master’s grave at Greyfriars churchyard in Edinburgh. When Constable Gray’s widow, Maureen, moves to Dunbar and takes Bobby with her Ewan is heartbroken. The little dog pines for his master and, realising how unhappy he is, Maureen sets him free. Bobby runs for miles, overcoming numerous obstacles, to get back to Edinburgh. Shortly after Bobby’s return Ewan is orphaned and sent to the workhouse. Once again, Bobby comes to the rescue and helps Ewan escape. Furious that Ewan has run away, Mr Johnson the Charity Commissioner reports Bobby for being unlicensed. It seems Bobby is about to be put down. Ewan begs the Lord Provost, William Chambers, to save his dog. Desperately, Ewan explains that Chambers actually owns Bobby because, as Lord Provost, the Greyfriars churchyard comes under his jurisdiction. Chambers rushes to court to argue the case but loses and it seems that there is no law that can save this loyal dog. Then Ewan remembers a treasured history book Constable Gray left him that points out that important people can receive the freedom of the city. The Lord Provost duly grants Bobby the freedom of Edinburgh and he is saved.