Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

WASHINGTON — Sen. Ted Cruz, R-Texas, said Tuesday that a staffer was responsible for "inadvertently" liking a tweet containing a pornographic video from his official account, embroiling the lawmaker in a social media firestorm.

“There are a number of people on the team that have access to the account and it appears that someone inadvertently hit the ‘like’ button,” he told NBC News Tuesday.

“It was a staffing issue, and it was inadvertent," Cruz said. "It was a mistake. It was not a deliberate action."

The lawmaker said his staff was dealing with the matter “internally,” and that it was “still being discussed” whether the person responsible for the “like” would retain access to the Twitter account.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Sen. Ted Cruz leaves after a vote at the Capitol in Washington on Sept. 5. Alex Wong / Getty Images

On Monday night, Cruz’s verified Twitter account, @TedCruz, “liked” a pornographic video that had been tweeted by the account @SexuallPosts.

Cruz’s account promptly “un-liked” it, but not before other Twitter users noticed and took screenshots.

Hours later, shortly after 2:00 a.m. Tuesday morning, a spokeswoman for Cruz said that the “like” had been removed.

“The offensive tweet posted on @tedcruz account earlier has been removed by staff and reported to Twitter,” Catherine Frazier, a senior communications adviser to Cruz, tweeted.

The offensive tweet posted on @tedcruz account earlier has been removed by staff and reported to Twitter — Catherine Frazier (@catblackfrazier) September 12, 2017

Comedians and other Twitter users, including former Rep. John Dingell, a Democrat, teased Cruz for the gaffe.

Ted Cruz did what now? — John Dingell (@JohnDingell) September 12, 2017

Ted Cruz will say he got hacked, but... pic.twitter.com/VL3nAKOTc2 — Zach Braff (@zachbraff) September 12, 2017

Only thing about Ted Cruz that I relate to. — billy eichner (@billyeichner) September 12, 2017

“Perhaps we should posted something like this during the Indiana primary,” Cruz joked Tuesday, alluding to his argument that, during his failed 2016 presidential bid, he did not receive enough media attention.

In 2007, as Texas’ state solicitor general, Cruz's office wrote a 76-page legal brief defending a ban on the sale and advertisement of sex toys.

The argument was rejected by a federal appeals court.

Frank Thorp V reported from Washington, with Adam Edelman reporting from New York.