Everyone has tried it at some point. The authorities started turning a blind eye years ago, but it wasn’t officially legalized until the summer of 2014. Finally, after more than 80 years of illegitimacy, the City of Oakland has legalized…pinball machines.

Pinball’s design history can help explain why it was illegal for so long. The game used to be a bit more like billiards — you’d shoot the ball onto the playfield with a pool stick.

In the 1860s, the pool cue turned into a spring-loaded plunger, that you’d pull and release to launch the ball. The game was made small, to fit on top of a counter at a bar or drugstore, and it looked like a simple wooden box, with no electricity, flashy art, or bright colors.

Winning an early pinball game was much more about luck than skill since there were no buttons to activate flippers on the sides. You basically had one action: pull the plunger and watch the ball go. Without the flippers, pinball was truly a game of chance — perfect for gambling.

The ball would shoot up the right side of the board and onto the playfield where there were little pockets that would catch it, and each pocket was stamped with a different point value. To add an extra challenge to the game, pins (which looked like little nails) were hammered into the board to obstruct the ball’s way into the pockets. That’s where the “pin” in pinball came from.

The first pinball games weren’t coin-operated. Bars would buy one and they would rent it out to people who wanted to play it and gamble with it, like a card table. By the 1930s pinball games were coin-operated and you’d find them all over the place, like in bars and drugstores, where you could win a cigar or a pack of gum with your spare change.

Then the owners of pinball machines started giving out cash prizes which solidified pinball’s status as a gambling machine. It’s around this point that pinball became electric, with lights and buzzers and bumpers that the ball could bounce off of to get more points.

Those points needed to be tallied up on a scoreboard, which lead to what is now referred to as the “back glass”— the part of the pinball machine that faces you as you play. The art on the back glass became one of the most iconic things about the pinball machine.

On newer games, a lot of the art is licensed from movies, like the 1991 blockbuster ‘The Addams Family,’ but a lot of the old games feature pictures of ladies in bathing suits, to appeal to men and boys.

All of the lights and buzzers and women in bathing suits just made people want to put more and more money into the machines. Pinball became really profitable. The mafia got involved.

With so much money disappearing into pinball machines, the authorities started cracking down. In the 1940s, more and more laws were being enacted to make pinball gambling harder, and manufacturers would try to circumvent these laws with labels that said, “FOR AMUSEMENT ONLY: no prizes no wagering.”

Still, everyone knew what the games were really for.

By the end of the 1940s pinball was banned in most major cities including Chicago and Los Angeles, but the pinball crackdown was most extreme in New York City, where, in 1942 Mayor LaGuardia ordered the NYPD to round up all of the machines. At a press event, the mayor personally shattered some of the machines with a sledgehammer and had them dumped into the Hudson River.

LaGuardia later reported that 2000 new police billy clubs would be made from the wooden legs of old pinball machines. Perfect for knocking the heads of pinball-playing ruffians.

LaGuardia did not succeed in ridding the world of pinball entirely though. It was still legal in some cities, and in New York, the game just moved into seedy underground establishments.

Meanwhile, game designers were still developing new features to save pinball. The most important development was the addition in 1947 of flippers, which allowed you to swat the ball around the playfield by pressing buttons on either side of the machine.

When the flippers were added to the pinball machine, it should have changed the game’s legal status. It wasn’t a game of chance anymore, because players could control the ball. Pinball manufacturers and game designers just needed some way to prove this.

Nearly 40 years after the introduction of the flipper, In April of 1976, pinball champion Roger Sharpe was called before the New York City Council to prove that pinball was a game of skill. With much dramatic flair, Sharpe demonstrated that he could move the ball with intention, and the city council voted 6-0 to pass the legislation and legalize pinball. Other cities followed New York’s lead, and within a year, pinball was legal again in most places across the country. It just took Oakland a few decades to catch up.

Ironically, after decades of fighting to prove that pinball could be a game of skill, it turned out the most lucrative bet for game makers was on gambling machines. The last big corporation to manufacture pinball machines lost millions of dollars on its pinball division and decided to shut it down in favor of a more profitable operation: making slot machines for casinos.

Bally’s Casinos used to be in the pinball business, and their name comes from their first hit pinball machine called “Ballyhoo.”

In 1999, Pinball tried to make a comeback with a game that integrated a video screen with the traditional mechanical playing field.

Despite the mountains of hyperbole heaped on the promotion of Pinball 2000, it never really caught on.

Still, pinball has a devoted fan base, that love of the game for its vintage, analog feel. Even long after the pinball was freed from seedy backrooms and smoky bars, it still feels like a rebel’s game. You don’t have to be smart or athletic to play it. Anyone can suck. Anybody can be great. It’s a nerd’s game, an underdog’s game, and now, it’s totally legal.

You can play tons of old pinball games and check out the early games at the Pacific Pinball Museum in Alameda, California.