Two officers, Herbert E. Liverman and Vance R. Richards, posted a conversation on Liverman’s Facebook page on June 17, 2013, that was critical of the department’s promotions of some unnamed, younger officers who they believed lacked sufficient experience. The department decided the comments violated the bar against negative comments.

The officers were given oral reprimands and six months’ probation. They later learned that as a result they were ineligible to sit for a promotional examination.

Afterward the two were the subject of several other complaints and department investigations, which they contend were retaliatory. Neither officer is still with the department. They filed suit in 2014, alleging, among other things, that the policy violated their First Amendment rights.

Andrew T. Bodoh, one of the officers’ lawyers, said in a prepared statement Thursday, “The decision means Liverman and Richards will have their day in court. Their constitutional rights were violated by this policy, as were the rights of all Petersburg police officers.”

Bodoh said the decision may require other government departments across several states to rewrite their social media policies. The Richmond-based appeals court covers the states of Virginia, West Virginia, Maryland, North Carolina and South Carolina.