A Texas police department on Wednesday honored a teen who was almost fired for buying an officer a free cookie earlier this month.

Katy Police Department posted a photo on Facebook of Zachary Randolph, 18, with three officers, commending the teen for his "selfless deed."

"It was our pleasure to finally meet the young man from Great American Cookies, who did a selfless deed despite what others may have thought," the Facebook caption said. "Sergeant McClure and the rest of the Katy Police Department would like to say thank you for supporting law enforcement and going the extra step to show your appreciation."

TEXAS COOKIE STORE EMPLOYEE WHO BOUGHT COP'S ORDER TEMPORARILY SUSPENDED

Randolph was working at the Great American Cookie Company in Katy Mills when he offered to pay for an officer's cookie, his mother Tami Randolph wrote in a Facebook post on July 5. She claimed a family in the store verbally attacked him after the kind act and said, "Are you going to buy mine too?" They also accused him of being racist and vowed to get the teen fired, according to the post.

Days after the incident, the company managers called the teen in and "wanted him fired." He was ultimately placed on suspension.

"Thankfully his manager refused and said you are an excellent worker and and everyone agreed that you did nothing wrong," the mother wrote in the post.

"Since when does buying a police officer a cookie give anyone else a reason to attack someone. And when did a Corporation want to FIRE someone for being KIND, taking what a customer said or did, regardless of how hateful they are," she added.

OWNER OF TEDDY BEAR WITH RECORDING OF SOLDIER DEPLOYED IN AFGHANISTAN FOUND IN CALIFORNIA

Randolph's post garnered thousands of reactions, with many people commending the teen for his selfless act.

Great American Cookies Company on Monday issued a lengthy statement apologizing to Zack Randolph and said the suspension was due to a misunderstanding.

"On behalf of Great American Cookies, we are sorry. This type of situation is not indicative of our Brand," the statement read.

The suspension was lifted and the person who oversaw the situation was "relieved of all duties and responsibilities" related to the stand, according to the statement.