It happened so quickly that Ben Srigley didn’t have time to ponder his lawbreaking.

With three pit bulls attacking a young boy on the street outside his Northwest Washington home in January, he grabbed a 9mm Ruger P90 handgun from his bedroom, ran outside, and shot and killed one of the dogs. A D.C. police officer shot and killed the other two.

Srigley legally bought the handgun in Virginia but failed to register it in the District. His act of saving a child’s life exposed him as a criminal, and as unwitting fodder for gun-rights advocates who saw his case a perfect example of why they assail as draconian the District’s laws that make owning guns exceedingly difficult.

Srigley’s action left the D.C. attorney general’s office, which typically prosecutes gun offenses involving unregistered firearms, with a conundrum: criminally charge and possibly jail a man deemed a hero in his Brightwood neighborhood, or leave him be and endure criticism that some of the strictest gun laws in the nation are not evenly enforced.

Deputy Attorney General Andrew Fois called it a “one in 10 million case” in which authorities “tried to balance what he did, the law that he broke, the circumstances under which he broke it and what he did to help the boy.”

Fois’s team offered Srigley a deal in May to spare him jail. First, he would pay a $1,000 fine. Then, after a planned move to Maryland, he would register his handgun and two long guns he had in storage. Lastly, he would stay out of trouble for two months. In return, a charge of possessing an unregistered firearm would be deferred until July.

On Tuesday, the conditions met, D.C. Superior Court Michael J. McCarthy accepted the prosecutor’s motion to dismiss the charge. Srigley can now petition to have the arrest expunged.

“We don’t want people to not help,” Fois said, explaining that the unique circumstances of Srigley’s case prompted much discussion in his office. “But when you break the gun laws, it’s not something we can turn a blind eye to. He made amends by paying a decent fine, and he registered his guns, and he moved out of town. The laws of the District of Columbia are vindicated, while recognizing the unique contribution he made saving a young boy’s life.”

Srigley, 39, runs a home remodeling company and recently got married. He had little time or inclination to become an advocate for either side in the gun debate raging around the country and in the District, even with attempts to use his case as an example of firearm laws run amok.

Srigley has not spoken publicly about his ordeal, and he chose to stay quiet after the case was dismissed Tuesday. His attorney, Danny C. Onorato, a former federal prosecutor who took the case for free, said his client’s only position is that he is “grateful he was able to save the life of a child. He is not commenting on society’s gun laws.”

Onorato said Srigley “regrets that he violated the law but he’s happy he had a gun that day. He does not want to be a poster child for gun advocacy.”

The pit bull shooting came just nine days after the District’s attorney general refused to charge NBC journalist David Gregory for waving an empty ammunition clip on national television, which is a crime, enraging critics who said the decision favored celebrities and demonstrated the hypocrisy of the stiff gun laws.

Srigley’s case got caught up in similar rhetoric. “The day we allow the state to criminalize acts of compassion and heroism is the day we become a nation of cowards,” said Peter Upton, founder of a group called Second Amendment Check, which helped raise money for Srigley’s defense.

But Srigley did not want the money. In his only public comment, he posted a statement on his company’s Facebook page saying that he would give all money — $1,080 in the end — to the injured child to defray medical bills from therapy and surgery. He paid the $1,000 fine out of his pocket.

The uncle of the injured 11-year-old boy said this week that the youngster is recovering and is back running around the neighborhood with his friends. He was bitten by the pit bulls on both legs and both arms. But he still refuses to jump on the Huffy bicycle with orange rims that he got for Christmas. He was riding that bike when he collided with one of the pit bulls, setting off the vicious attack.

“He’s holding up, but he’s still going through therapy,” said the uncle, who is not being named to protect the identity of the victim. “He’s still a little shaken.”

The uncle confirmed that Srigley stopped by with a check to help with the bills, and he lamented that the neighbor who saved his nephew has moved out of the corner house, which now stands empty. “He’s a nice guy,” the uncle said of Srigley. He also believes it is unfair to charge his former neighbor. “But I’m not surprised by it,” he said. “You know how D.C. laws are.”

The owner of the three pit bulls, Andrew E. Paige, lives up the street from the boy; in the aftermath of the shooting, bloody paw prints from one of the wounded dogs led from the scene of the attack to his front door, where that dog died. The other two dogs died where they had been shot.

Authorities charged Paige with three counts of having a dog off a leash and three counts of keeping a dangerous dog. He faces $30,000 in fines and 30 days in jail if convicted. He has a court hearing scheduled for next month.

Srigley’s attorney said his client knew his gun was illegal — he declined to say why it was never registered — but he heard the child’s screams and acted on instinct. “He could have made a choice not to intervene,” Onorato said. “Instead, he had a handgun and he used it properly to defend that child. We’re all thankful he took that action.”