The strange story of “Signalman Jack” starts with a tragic accident.

In the mid-1800s, a man named James Wide worked for Cape Government Railways in South Africa. Wide was a guard, and he developed the nickname “Jumper” for his habit of jumping between the moving trains. Unfortunately, during one of these death-defying jumps, Wide slipped and slid beneath a train, losing both of his legs at the knees.

This was long before the days of worker’s compensation laws and government safety regulations, so Wide didn’t receive any sort of financial support from his employer—in fact, he was in danger of losing his job. After building himself a pair of peg legs, Wide considered his options.

While contemplating his fate, he visited a local market and saw the answer to his problem: a chacma baboon named Jack. Jack was effectively managing a pair of oxen for his owner, and, impressed by the monkey’s intelligence, Wide purchased him on the spot.

Jack moved into Wide’s house, which was about half a mile from the railway station.

Wide built a special trolley and taught Jack to push it to the railway station. For weeks, Jack would push Wide back and forth, providing occasional assistance as Wide went about his work.

Gradually, however, Wide realized that the baboon was capable of handling some of his duties. Jack could listen to the whistles from the oncoming trains and interpret them correctly, so Wide figured that the monkey could work the levers that controlled the train tracks.

Remarkably, this worked. Jack quickly learned how to route trains correctly, and with Wide supervising, he became South Africa’s first non-human signalman.

But passengers didn’t appreciate the unusual setup.

When one traveler saw a baboon working the railway signals, he filed a formal complaint. Authorities looked into the matter and immediately terminated Wide’s employment.

Wide disputed the decision, insisting that Jack was fully qualified for his post; other railway authorities backed Wide’s claim. The railroad agreed to re-hire Jack and Wide, but only if the baboon could prove his capabilities as a signalman.

The railway authorities constructed a difficult test, with multiple horns tooting different types of signals at a rapid pace. The baboon passed without committing a single error.

Satisfied with the results, the railway re-hired Wide and gave Jack an official position.

His salary was about 20 cents per day, according to science journal Nature, along with a half-can of beer per week.

Jack had other duties at the railway, all of which he performed exceptionally. The monkey would wake railway sleepers—likely giving them the scare of a lifetime—and tend to the railway garden. Over time, the railway became a popular tourist attraction.

Sadly, Jack passed away of tuberculosis in 1890. He’s still a popular figure in South Africa, but despite his popularity, no railroad has attempted to train other baboons to act as signalmen.

So the next time you’re patting yourself on the back for handling a difficult task at work, just remember that a monkey regularly controlled the fates of thousands of train passengers without making a single mistake. Jack was, after all, one of a kind.