Spike Lee is holding court on the sunbaked rooftop terrace of the Cannes Film Festival hub, the Palais des Festivals, doing his best Peter O’Toole impression.

A passionate cinephile, Lee likes to punctuate his points with movie references or classic stand-up lines or sports metaphors. When it’s suggested to him that his furious statement on race in Donald Trump’s America, “BlacKkKlansman,” has rocked Cannes like nothing else at this year’s festival, he smiles.

“Did you ever see one of the greatest films that was ever made? David Lean’s ‘Lawrence of Arabia,’” says Lee before raising his voice to a sonorous battle cry.

“Taaaaaake nooooo prisoners!”

BlacKkKlansman Trailer #1 (2018) | Movieclips Trailers

For even a filmmaker who has seldom pulled punches when it comes to straight taking — what he would call “da truth, Ruth” — “BlacKkKlansman” is a haymaker. The film, which is in competition for Cannes’ Palme d’Or, is the true-life tale of an African-American police detective Ron Stallworth (played in the film by John David Washington, son of Denzel), who in 1979 infiltrated a Colorado Springs, Colorado, cell of the Ku Klux Klan.

Introduced to the project by producer Jordan Peele (“Get Out”), Lee made what he knew would be a commentary on race in America. Then, during a summer weekend in Martha’s Vineyard, he saw his film run directly up to present day. On the TV was news of the white supremacist march in Charlottesville, Virginia, that turned violent in clashes with counter-protesters. Anti-racism activist Heather Heyer was run over and killed.

Former KKK leader David Duke, who’s played by Topher Grace in “BlacKkKlansman,” was part of the rally. After it, President Donald Trump blamed “both sides” for the violence. For Lee, it was a “defining moment” for Trump and the United States. (In a press conference in Cannes on Tuesday, he blasted the president in a passionate, expletive-filled monologue.)

Lee decided to end “BlacKkKlansman” with footage from Charlottesville (he sought and received permission from Heyer’s mother) and of Trump’s speech. The film concludes with the image of an upside-down black-and-white American flag.

“Those terrorist groups wrote themselves into the film,” Lee said in an interview. “The real-life David Duke wrote himself into the film. The president of the United States wrote himself into the film. They gave us an ending we’re not good enough to write.”

Focus Features will release the film in August on the anniversary of Charlottesville.

“Take the past and make it present was the real approach Spike and I wanted to take with it,” says co-writer Kevin Willmott. “And unfortunately, the events of today just presented themselves. They’ve taken the past and brought it back to the present.”

Many in the cast were surprised by the film’s unscripted conclusion. Asked when he found out, Washington replies: “Uh, when I saw it. And it messed me up. I was emotional. I was fighting (tears) back.”

Washington has known Lee since his father, one of Lee’s favorite leading men, made “Malcolm X” with him and the younger Washington had a small role. But as to the first time they met, Lee lights up and mimics cradling a baby. “BlacKkKlansman” is a breakthrough for the 33-year-old Washington, a former professional football player.

The cast is filled with what Lee calls “new blood” — actors he hasn’t worked with before. Among them is Adam Driver, who plays Stallworth’s Jewish partner. Driver calls Lee’s revision “a testament to his movies’ unpredictability.”

“And it’s like how he directs on set — following your impulses. He’s worked with most of the same crew members since ’Do the Right Thing,’” Driver said. “That’s what I like about his movies. They’re filled with an energy that you never know what’s going to happen.”

“BlacKkKlansman” is also, in part, about the influence movies can have. It begins with the flying Confederate flag of “Gone With the Wind” and shows the Klan members enthralled by D.W. Griffith’s “The Birth of a Nation.” But it also captures characters lovingly discussing “Shaft” and “Superfly.”

“Here’s the first time I really realized what a movie can do. I went to see a Bruce Lee film on 42nd Street, and when people came out of there, people were doing flying kicks all over the sidewalk,” says Lee with a karate chop of his own.” And it clicked for me: That is a power.”