His career in law enforcement may be taking a hit.

A cop was busted for allegedly selling marijuana — inside a Brooklyn liquor store that sources say he ­co-owns.

Gilberto Mercedes was arrested in the Neighborhood Liquor Store at Knickerbocker and Putnam avenues in Bushwick at about 5:25 p.m. Friday for allegedly selling a $25 ziplock bag of marijuana, according to police.

Mercedes, 42, also was accused of endangering the welfare of a child — for allegedly selling a bottle of vodka to an informant who is under the age of 21.

Mercedes, who is stationed in The Bronx, has been with the NYPD for 14 years, cops said. He made more than $85,000 last year, records show.

He was suspended without pay.

Mercedes’ family and friends were stunned by the allegations, insisting he never sold drugs.

“It’s shocking,” his father, Cruz Mercedes, told The Post through a Spanish translator.

The 66-year-old dad, who lives down the block from the liquor store, said his son is a divorced war veteran with three kids who lives in The Bronx.

The officer’s lawyer, Patrick Brackley, insisted at Gilberto’s arraignment that his client does not own — or even work — at

the ­liquor store.

Mercedes has been charged with criminal sale and possession of marijuana, weapon possession and unlawfully dealing with a child for the alleged booze sale to a 19-year-old.

Brackley said, “[The gun] was not his weapon and he had no knowledge of its presence.’’

Bail was set at $10,000.

Brackley said he hoped his client will be able to post it before the court closes for the night.

Police said Internal Affairs is investigating.

A man behind the counter at the liquor store insisted that the charges were bogus.

He called the allegations “100 percent false.”

“He is a good guy, come on,” said the visibly upset employee.

Cruz said he hadn’t spoken to his son since the arrest.

“Nothing bad is going to happen to him,” the officer’s dad insisted.

“He is not guilty. They have to let him go free. He wouldn’t do such a thing.

“He is a calm kid. Everybody on the block likes, everybody gets along with him. He is a good kid.”

State law allows police officers to work up to 20 hours a week on another job — as long as it doesn’t conflict with city or department rules.

NYPD officers must fill out an Off-Duty Employment Application and a superior must sign off.

Additional reporting by Allison Griffin