A police force reposted a tweet by a former officer mocking the shadow home secretary Diane Abbott.
The tweet, which pretended the Labour MP had been "caught up in a stop and search drama" looking for her house keys has since been removed from the Thames Valley Roads Policing page.
The original post was by ex-officer Norman Brennan who is against Ms Abbott's stance on stop and search.
Thames Valley Police has "apologised for any offence" it may have caused.
Last year the force advised its social media accounts will not be used to answer queries, stating "our Joint Roads Policing Unit... will post messages on social media to inform the public about RTCs that are causing disruption to our road network".
Det Ch Supt Gilbert Houalla said the post shared at the weekend had been deleted from the roads policing account and that the force did not "endorse the tweet in any way".
He added: "(We) will continue to ensure that our officers and staff know what is and is not appropriate to post via our official channels.
"We have contacted Diane Abbott's office and have unreservedly apologised for any offence this may have caused."
In response to the post, Ms Abbott told the BBC: "We welcome the apology.
"Evidenced based stop and search can be a useful tool in fighting crime, but the police's own data shows that random stops disproportionately affect black and Asian people."