'How I Met Your Mother' star arrested for carrying a loaded gun in an airport

Actor David Henrie, who starred alongside Selena Gomez on the Disney show “Wizards of Waverly Place,” has reportedly been arrested after authorities found a loaded gun among his belongings at an airport.

According to TMZ, Henrie was going through a TSA screening at Los Angeles International Airport Monday morning when agents reportedly discovered an M&P Shield 9mm pistol that was loaded. He was immediately detained and then taken to a nearby police station, the outlet reports.

Later on Monday, Henrie took to Twitter to apologize, saying that he was "humiliated" and "embarrassed."

"I take responsibility for the situation at LAX today," the 29-year-old actor wrote. "I unintentionally brought my legally owned gun which is registered in my name to the airport. I am so sorry for any trouble it caused, but I am appreciative of TSA's efforts in implementing the safety laws that are in place to protect our beautiful country."

He continued: "More than anything I am humiliated and embarrassed that this even happened. But I am thankful to the TSA, LAPD and all involved today for their kindness and their professionalism during this process."

Reps for the actor did not immediately respond to Fox News’ request for comment.

Henrie played the brother of Gomez’s character, Justin Russo, on the show from 2007 until 2012.

Fans of the CBS sitcom “How I Met Your Mother” may recognize him as the son that the Ted Mosby character is speaking to in the future throughout the series.

It’s unclear at this time why Henrie was allegedly carrying the weapon through the airport.