– The story began with what sounded like a punchline: The crown prince of Denmark walked into a bar. Or, at least, he tried to — before Queensland’s new ID laws stopped him short.

Late Friday, Australian undercover officers protecting Frederik, the 49-year-old heir to the throne of Denmark, tried to facilitate his entry into Brisbane’s Jade Buddha Bar and Kitchen. But according to the bar’s management, he was turned away because he lacked identification.

Luckily for the crown prince, he was allowed in 15 minutes later, the bar’s management said. But the episode has drawn attention to a new state law that has disappointed Australians and tourists alike by requiring that their identification be scanned to get into certain bars after 10 p.m.

Speaking on the “Sunrise” television program Tuesday morning, Phil Hogan, co-owner of the bar, said that when his security personnel were asked by the undercover officers whether they recognized the prince, they had a sheepish response: “No, not really. No offense, your honor.”

Even after the bar verified the identities of the people in the prince’s entourage, Hogan said, they were caught in a bind “because if we let him in, we do so in front of six police officers and we potentially break the law.”

The prince is no stranger to Australian bars: He met his Australian-born wife, Princess Mary, in a pub during the Sydney Olympics in 2000. But it appeared he had missed the memo on Queensland’s new laws, which went into effect July 1 and affect more than 200 licensed businesses.

Nightspots are required to scan each patron’s identification, with the information then compared with a police or court database of those with banning orders stemming from previous offenses.

The legislation was introduced by the government of Queensland’s premier, Annastacia Palaszczuk, to quell alcohol-fueled violence, but venue owners and bar patrons have voiced frustrations over its rollout, which they say has led to long lines, declining revenues and concerns over data security.

Ryan Lane, general manager at the Gresham, a bar in Brisbane, said that while scanning IDs could make nightspots safer, the government’s failure to consult with the bar industry over the new rules had hurt quieter establishments.

Just last month, the Gresham made headlines by turning away a dozen French winemakers who had not brought identification.

“Perfectly sober. Well dressed. Incredibly polite,” Lane said in describing them. “They finished their workday and wanted a nightcap before their hotel.”

“It was so embarrassing,” he added. “And on the world stage, we look a bit silly.”

Additionally, scanners must be approved by the government and can only be operated by licensed operators, which can rack up the costs of enforcement. One venue owner, Jamie Webb, told the local news media last month that he lost about 25,000 Australian dollars, or about $20,000, in one week.

The government has acknowledged there would be “teething issues,” but has stood by the legislation.

In Queensland’s Parliament on Tuesday morning, Yvette D’Ath, Queensland’s attorney general and minister of justice, said that about 1.4 million people had entered licensed venues with scanners and that banning orders involving 76 people had been found.

“We will never truly know how many lives are saved and how many assaults we stop by having these scanners in place,” she said, “But knowing that parents are more likely to have their child come home safe because they are there,” she said in reference to the scanners, “is worth it.”

After a day of coverage, the story of the crown prince had drawn strong attention on social media in Australia. Many people were amused at the thought of a foreign prince being subject to the state’s laws. The interest even prompted Ian Stewart, the Queensland police commissioner, to hold a news conference Tuesday that seemed to contradict some news reports of what had happened.

It was “not correct,” he said, that the prince had been denied entry based on Queensland’s ID laws. The prince’s entry had been facilitated, he said, by his security detail, who left the entrance after a first meeting with bar staff members and returned for a second.

“The prince at no time was party to those conversations and wasn’t even present when the security personnel made those arrangements,” he said. It was still unclear whether the prince’s security had refused to provide ID to the bar in those conversations, the commissioner added. But it would have been unusual for a person of the prince’s status to have to provide a driver’s license or undergo a scan, he said.

The premise of the ID scanning laws, he said, was to identify and keep out people who would harm others. “The club certainly knew that his royal highness was who he was and that he was going into their club,” he said. “It’s certainly my understanding that they had no concern as long as we vouched for his bona fides.”

According to Hogan, the crown prince took the episode in stride. While the venue manager was frantically organizing cocktail servers to cater to the prince, Hogan said, his highness walked directly up to the bar for his drink of choice.

“He bought a dark and stormy,” Hogan added. “So to give him credit, he seems like a very nice fellow.”