Six Boston cops fired after testing positive for cocaine have been ordered reinstated — with back pay — after a state board struck down hair tests as ?unreliable in a bombshell ruling that could have a far-reaching impact on how city workers are drug-tested.

UPDATE: Menino vows fight on cops’ reinstatement

In a stunning, 134-page ruling, the Massachusetts Civil Service Commission this week ordered the six cops back on the job, finding that “the present state of hair testing for drugs of abuse … does not meet the standard of reliability necessary to be routinely used” to fire someone.

“Hair testing for drugs of abuse has not achieved general acceptance within the scientific or law enforcement communities,” the board wrote. “A reported positive test result is not necessarily conclusive of ingestion and … may or may not justify termination.”

The six ex-cops — Richard Beckers, Ronnie Jones, Jacqueline McGowan, Shawn Harris, Walter Washington and George Downing — failed drug tests when cocaine showed up in their hair samples in the early to mid-2000s, records state. They all appealed and the board ruled that all should be reinstated with back pay to October 2010, which is when Civil Service took on the case.

For McGowan, the positive test was her second — and she testified before the commission that she was formerly a “regular” cocaine user, the ruling states. Attempts to reach all the officers last night were unsuccessful.

Their union-paid attorney, Alan Shapiro, called the ruling “enormously gratifying.”

“Finally, somebody that has looked at all the science of this has said, ‘No, you can’t do that,’ ” Shapiro said last night. “The science is not the holy grail that it was held out to be.”

Dot Joyce, spokeswoman for Mayor Thomas M. Menino, said the city is “weighing its options for appeal.”

“This decision could have impacts across the city,” she said.

Four other former cops who appealed over their failed drug tests — Preston Thompson, Oscar Bridgeman, Rudy Guity and William Bridgeforth — had their firings upheld, according to the commission.

Some of them made excuses for their failed tests, including Bridgeforth, who told the commission he may have had false positive tests because he brushed white powder off the seat of his cruiser, which he “assumed was confectionery powder from doughnuts.” He also said he lived in a townhouse that shared a heating vent with neighbors who were crack smokers, records state.

Bridgeman, meanwhile, told commissioners he believed his positive test was because he had a “habit of putting drugs … from suspects in his pocket where he also kept cookies to eat.”

Guity, who once served on the drug unit, blamed his positive tests on lidocaine he was prescribed after surgery. The state unemployment board found the claim “credible” and awarded him benefits. Several of the others also have been granted unemployment pay, records show.