Updated June 1: Revised to include new Whataburger statement.

Whataburger is apologizing after a manager at a southeast Texas store refused to serve a police officer because of his gun.

KTRK-TV reports that a plain-clothes detective walked into the restaurant on Parkwood Drive in Friendswood, about 20 miles southeast of Houston, on Thursday morning. His gun was holstered at his side, next to his badge.

When the manager wouldn't serve him, he said that he was a Friendswood police officer, the department told KTRK. But he left when that didn't sway the Whataburger employee.

The fast-food chain decided to prohibit open carrying of guns in its stores when Texas' open-carry law went into effect in 2016 — but carved out an exception for law-enforcement officers. (Whataburger still allows concealed carry.)

Whataburger said in a statement that it was reaching out to apologize to the detective about the "unfortunate misunderstanding" and that the company would work to retrain its employees on the open-carry policy.

"We want to make it clear that he and all law enforcement are welcome in our restaurants and we're proud to serve them," the statement said.

On Friday, Whataburger said in a new statement that it had spoken to the detective, who accepted the company's apology and planned to return to the store.

Whataburger has been praised in the past for taking quick action in similar situations. In October, the company fired an employee who cursed at two Denison officers and refused to serve them. Whataburger also fired a worker at a Lewisville restaurant who wouldn't serve a pair of officers in 2015.