A D.C. police officer will not be prosecuted for allegedly telling colleagues that he wanted to shoot first lady Michelle Obama, although he could be disciplined for violating the police department’s code of conduct, authorities said Thursday.

The officer, a 17-year member of the force who has not been publicly identified by his superiors, was stripped of his police powers and assigned to a desk job in July after officials learned of the alleged remark. He had been a motorcycle officer in a police unit that helps escort motorcades for dignitaries, including President Obama and his family.

“Our investigation is complete, and there will be no criminal charges resulting from it,” said Edwin Donovan, a spokesman for the U.S. Secret Service, which conducted a joint inquiry with D.C. police detectives.

Bill Miller, a spokesman for the U.S. attorney’s office in the District, said that federal prosecutors reviewed the findings of the investigation and “made the decision not to go forward.”

An official familiar with the case, speaking on the condition of anonymity because the matter is not fully resolved, said Secret Service agents and police concluded that the officer “wasn’t being serious” when he allegedly made the remark.

“What’s always important is intent,” the official said. “And we did everything we could to figure that out — whether it was serious or just a very bad joke.”

Police Chief Cathy L. Lanier, in her regularly weekly appearance on WTOP radio, said Thursday that the officer remains the focus of an internal investigation for possible conduct unbecoming an officer. Lanier has said that “there’s absolutely no place for jokes that could be perceived as a threat to the first lady” or anyone else.

Police officials said the officer’s alleged remark was made over breakfast in a downtown restaurant with several other officers from the department’s Special Operations Division. One of the officers reported the comment, officials said.

The officials said that according to reports they received, the officer used his cellphone while he talked about shooting the first lady, possibly using the phone to play a sound effect of gunfire.