Mr. Depp, who was introducing a screening of the 2004 film “The Libertine” — in which he played the womanizing poet John Wilmot, second earl of Rochester — acknowledged that his words would cause a storm.
“By the way, this is going to be in the press and it’ll be horrible,” he said. “It’s just a question; I’m not insinuating anything.”
Mr. Depp’s comments immediately drew rebukes, including from the White House.
On Friday afternoon, Sean Spicer, the White House press secretary, invoked Mr. Depp and Kathy Griffin, the comedian who last month appeared with a fake decapitated head of the president, in responding to a question about a Shakespeare in the Park production of “Julius Caesar” that has drawn criticism from Republicans for depicting a Trump-like Caesar being assassinated.
Mr. Spicer said he did not know if the president was aware of the play, but “whether it’s that or Johnny Depp’s comments,” there is a “troubling lack of outrage we’ve seen in some of these incidents.”
“The president’s made it clear that we should denounce violence in all of its forms, and if we’re going to hold to that standard than we should agree that that standard should be universally applied,” Mr. Spicer said.
On Friday, Mr. Depp apologized for his remarks in a statement to People magazine. “I apologize for the bad joke I attempted last night in poor taste about President Trump,” he said. “It did not come out as intended, and I intended no malice. I was only trying to amuse, not to harm anyone.”
Critics had described the comments as particularly distasteful and dangerous given their timing. A gunman, believed to be upset about Mr. Trump’s election, opened fire last week at members of the Republican congressional baseball team in a Washington suburb.
“Secret Service, we have video evidence of Johnny Depp threatening to assassinate President Trump. Please do something!” an account linked to Tennessee Republicans wrote on Twitter. Others suggested a boycott of Mr. Depp’s films, although supporters countered that the remarks had clearly been made in jest.
Mr. Depp is not the first celebrity to come under fire for making violent allusions toward Mr. Trump, spurring a debate about where to draw the line regarding incitement, political commentary and art when it comes to a president who has shown no reluctance to antagonize opponents.
In May, after Ms. Griffin posed with what appeared to be the bloodied and severed head of the president, Mr. Trump said the image had upset his family. There was outrage across the political spectrum, and CNN fired Ms. Griffin from her job as co-host of its New Year’s Eve program.
“Kathy Griffin should be ashamed of herself,” the president wrote on Twitter. “My children, especially my 11 year old son, Barron, are having a hard time with this. Sick!”
In January, the singer Madonna, speaking at the Women’s March on Washington, said that she’d “thought an awful lot about blowing up the White House.”
Mr. Trump himself has come under attack for remarks about physical harm against his political opponents. During the presidential campaign, he mused aloud about supporters of gun rights taking matters into their own hands if Hillary Clinton were to become president and appoint judges who supported tighter gun control regulations.
The suggestion, however oblique, provoked strong objections, including from Bernice A. King, daughter of the Rev. Dr. Martin Luther King Jr., who called Mr. Trump’s words “distasteful, disturbing, dangerous.”
Mr. Depp, 54, is known for performances in films like “Pirates of the Caribbean” and “Edward Scissorhands,” and he has been nominated three times for an Academy Award. He has been in the headlines recently over his divorce from the actress Amber Heard and reports of financial difficulties.