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

Just over five decades ago, the Spanish army built a cemetery with more than 5,000 graves in northern Spain. No one would ever get buried there, but the site became world famous — especially among avid moviegoers.

Fans will recognize the cemetery's circular stonewall and its rows of wooden crosses and gravestones surrounding it as the set for the epic three-way duel between Clint Eastwood, Lee Van Cleef and Eli Wallach in Sergio Leone’s 1966 groundbreaking movie, “The Good, the Bad and the Ugly.”

"Spaghetti Western" is the term that came to describe a series of 1960s and ’70s movies made by European directors like Leone, an Italian filmmaker who loved Westerns. The Spanish army built the Sad Hill Cemetery following Leone’s instructions, and after the film, the cemetery set lay abandoned.

The tomb of Quentin Tarantino in Sad Hill. Courtesy of DYP Comunicación

In 2015, four Spanish fans organized volunteers from France, Italy, the United States and other countries to dig up and rebuild the fake graveyard.

For the founding members of the Sad Hill restoration campaign, “The Good, the Bad and the Ugly” was not only a story about three bounty hunters on a quest to find $200,000 in gold. It also told a Spanish story about their home in Burgos and some of their families and neighbors who had been extras in Leone’s film.

Spain is still a popular location for many top foreign films and TV shows. In just a few hours by car or plane, directors can choose from a variety of sites including desert landscapes, snowy mountains, lush forests and tropical islands.

These breathtaking landscapes, combined with low-cost labor and tax breaks, have made Spain an attractive location for big TV dramas like “Game of Thrones” and the Star Wars movie prequel “Solo: A Star Wars Story."

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Spain has been the location for many legendary movies: David Lean’s “Lawrence of Arabia” and “Doctor Zhivago”; Orson Welles’ “Falstaff — Chimes at Midnight”; Joseph L. Mankiewicz’s “Cleopatra”; and Steven Spielberg’s “Empire of the Sun” and “Indiana Jones and the Last Crusade.” At least 180 foreign films dating to 1916 have been filmed in Spain.

Since then, movie sets like the Sad Hill Cemetery have become quasi-religious sites for devoted fans all over the world. They sometimes travel thousands of miles to visit hard-to-reach places so that they can experience up close and in person everything they saw on film.

The first day of shooting "Sad Hill Unearthed." Courtesy of DYP Comunicación

This was the case for Spanish filmmaker Guillermo de Oliveira. A proud movie buff himself, he has visited many famous sites including the Swiss dam where the bungee-jump scene from James Bond’s "Goldeneye" was shot and the "Star Wars" sets in Tunisia where Luke Skywalker grew up.

When Oliveira heard that a group of fans were teaming up to unearth and rebuild the Sad Hill Cemetery, he recognized something familiar in their passion and commitment, and bought a camera and drone to document their story.

Oliveira eventually released a documentary about the movie set restoration named “Sad Hill Unearthed” in 2017, which is now available on Netflix, and was nominated for best documentary in Spain’s 2019 annual film awards, the Goya Awards.

“This news blew my mind,” he told NBC News. “Not only did a set that I thought had been lost 50 years ago still exist, but on top of everything else a group of people wanted to resurrect it.”

The movie shows how Leone used Spain’s striking landscapes to recreate a very American story about roaming cowboys. The documentary says that Leone compared the climate and landscape in Spain to the United States. Burgos reminded him of Virginia, while Almería — the location of another set, in southern Spain — was compared to Arizona and New Mexico.

On camera, fans and critics can see how “The Good, the Bad and the Ugly” looks and feels like Spain, Italy or Mexico. Viewers will note Eastwood’s poncho and vest, the sound of a Spanish guitar and a mariachi trumpet playing before the climactic duel. Even the circular design of the cemetery resembles a bullfighting arena in Spain or a Roman coliseum.

Movies reflect cowboys' forgotten Spanish, Mexican roots

For historians, these movie intersections between the Mediterranean and North America also played out in real life, and can be seen in the forgotten Spanish and Mexican roots of American cowboy culture.

“The fact that so many words associated with the ‘Western’ vocabulary of the quintessentially American cowboy come into English directly from Spanish would seem to be an indication of how the Spaniards and Mexicans, in many ways, were already ‘there’ when English-speaking settlers began arriving to the Southwest and West, pretty much all of which was Spanish territory until 1821, and Mexican territory until 1848,” said New York University professor James D. Fernández.

Director Guillermo de Oliveira at Betterville Concentration Camp, one of the locations for "Sad Hill Unearthed." Courtesy of DYP Comunicación

Fernández told NBC News that language can sometimes reveal layers of history that cannot be easily recovered in an archaeological dig. He pointed out how words used by early Spaniards and Mexicans in southwestern states were adopted into English by later generations of American cowboys—“buckaroo” originates from the Spanish word “vaquero”; “hoosegow” is “juzgado”; “calaboose” is “calabozo”; “mustang” is “mesteño”; “lasso” is “lazo”; and “lariat” is “la riata”.

For Oliveira, Sergio Leone’s recreation of the Wild West into a Mediterranean-like drama showed him how movies and sets can tell much bigger stories about humanity's connections.

“Originally, I thought I would just join them for a couple of weekends,” the filmmaker said, referring to fans digging up and rebuilding the movie cemetery. “The idea was so crazy and beautiful. But when more people started coming, I felt that inside that story was another type of story, a poetic idea.”

FOLLOW NBC LATINO ON FACEBOOK, TWITTER AND INSTAGRAM.