It wasn’t clear whether the windmill would ever turn into a giant, but after almost two decades, the director Terry Gilliam has finally finished shooting “The Man Who Killed Don Quixote.” The film had experienced so many stops and starts that there was even a documentary, “Lost in La Mancha” (2002), about its struggles to get made.

“Sorry for the long silence. I’ve been busy packing the truck and am now heading home,” Mr. Gilliam said in a post on Facebook on Sunday. “After 17 years, we have completed the shoot of THE MAN WHO KILLED DON QUIXOTE. Muchas gracias to all the team and believers. QUIXOTE VIVE!”

The film, a passion project for Mr. Gilliam since the late 1980s, started shooting in 2000 but endured a number of setbacks: lead actors cycled in and out, flash floods stopped production and financing was a problem.

Now, the movie enters post-production and even then, the process hasn’t been without hitches. The Portuguese government is investigating allegations that a UNESCO World Heritage site, the 12th-century Convent of Christ in Tomar, was damaged during filming, a claim that Mr. Gilliam vigorously denied.