The 64-year-old became the first ethnic Chinese in the post when he was appointed in 2011, going on to gain quasi-celebrity status for his modest style and for drawing attention to China's unhealthy skies.
But Locke, who left his role today, received a highly undiplomatic sendoff from the China News Service in a sneering editorial which referred to him as a "banana", and a "guide dog" for helping a blind activist.
"He is a banana with yellow skin and a white heart", yesterday's article opened by saying, calling Locke's ethnicity a ploy by the US to win Chinese hearts and minds while seeking to kick up trouble in the region.
Locke was viewed as a trailblazer in highlighting the PM 2.5 particulate matter carried in the thick blankets of smog pervading China's capital.
Also Read
He presided over the introduction of PM 2.5 monitors at the US embassy and consulates around China, drawing widespread attention to the stubborn problem of pollution.
But the official agency wrote that "once Locke arrived, so did the Beijing smog".
It also scorned Locke's image as an unpretentious official known for carrying his own luggage and using a regular car in contrast to his Chinese counterparts.
The verbal attacks didn't stop there with the editorial deriding him as a "guide dog" for assisting the blind activist Chen Guangcheng in 2012.
Chen sought shelter in the US embassy after escaping house arrest in nearby Shandong province before being allowed to go to America with his family.
Many Chinese social media users criticised the essay and defended Locke.