When a mass of SWAT officers stormed into attorney Wil Miller’s Ballard home and arrested him for selling drugs, it wasn’t the first time a gun was pointed at his head.

After graduating from Duke Law School in 1988, Miller began his professional legal career in district attorneys’ offices in Brooklyn and Queens, where he prosecuted sex crimes, tried cases in the special victims’ bureau, and supervised investigations.

One late night in February 1991, Miller and his then-boyfriend were walking near Prospect Park when a man stopped them, pointed a gun, and demanded their money.

Miller recalled reaching into his pocket for cash, while his boyfriend fumbled for his wallet, which dropped to the ground. The robber panicked, kicked Miller’s boyfriend, and shot Miller in the head. Miller fell to the sidewalk and blacked out momentarily. When he regained consciousness, Miller looked up to see the assailant running away.

Miller was transported to a nearby hospital, where he learned that the bullet had grazed his left temple. His wound was cleaned, and he was released a few hours later. A New York Post reporter briefly interviewed Miller, whose bandaged face appeared on the front page of the newspaper’s weekend edition under the headline, “Miracle Man! Asst. DA walks away after being shot in the head by mugger.”

“For two days, every (convenience store) I went to in New York City had the Post and my picture on it,” said Miller. “People had me filling out Lotto cards, and they were calling me Miracle Man. Monday came, and nobody knew who I was.”

Miller was lucky — the weapon was an old, rusty, .32-caliber revolver. But the experience rattled his sense of safety in New York City.

“When I left New York, I left more enthusiastically in large part because of that experience.”