Two people stroll along part of Hadrian's Wall, near Birdoswald Roman Fort in Cumbria, northern England. (Jerry Harmer/AP)

When President Trump tweeted out a meme of his envisioned steel-slat wall with the words, “THE WALL IS COMING” over the weekend, many fans of “Game of Thrones” accused the president of never actually watching the hit HBO series.

In the series, the enormous wall of ice protecting the Seven Kingdoms from encroaching wildlings is — spoiler alert — eventually destroyed, which is presumably not the end result Trump envisions along the southern border. But Trump’s allusion to the “Game of Thrones” wall is all the more curious for another reason.

The fictional “Game of Thrones” barrier is actually based on a real wall. In fact, it’s one of the most famous walls in ancient Western civilization — one that may hold a lesson for Trump. A massive wall, said historian David Frye, is nothing without an equally massive investment in upkeep and patrol. That fact is evident in the true story of Hadrian’s Wall, the inspiration behind the fictional frozen wall in “Game of Thrones.”

George R.R. Martin, the author of the book series, “A Song of Ice and Fire,” that inspired “Game of Thrones,” has previously revealed that he was standing atop Hadrian’s Wall in 1981, imagining himself as a second-century Roman soldier, when he had the idea for his wall.

Completed in A.D. 128, Hadrian’s Wall stretches 73 miles between the North and Irish seas near the border of England and Scotland, representing the largest surviving Roman artifact anywhere in the world. The underlying reason Roman Emperor Hadrian wanted to build the wall is not so different, Frye said, from why Trump wants to build his: fear of who was on the other side.

“Fundamentally, what links them is the walls of the past and the walls of the present, military or not, are built for the purpose of security, and it’s this idea of security that is the timeless link,” Frye, the author of “Walls: A History of Civilization in Blood and Brick,” told The Washington Post. “There’s always insecurity. Insecurity is just a chronic form of fear, and it’s certainly insecurity that has driven the building of both the ancient and the modern walls.”

Emperor Hadrian, who ruled from A.D. 117 to A.D. 138, sounds like a guy Trump would have liked to play golf with. He was the first great wall builder in Western civilization — “no one built border walls to the extent Hadrian did,” Frye said. He built more than one great wall. He built other less impressive walls everywhere, on three continents, seeking to harden the Roman Empire’s borders rather than continue expanding them, as his predecessor, Trajan, had done.

In his 2018 book “Hadrian’s Wall,” British historian Adrian Goldsworthy described the emperor and his obsession with big-ticket construction like this: “The initial design for Hadrian’s Wall was grand, if not as grand as it would become, and this is an indication of the emperor’s personal involvement. Hadrian was obsessed with architecture and loved designing great buildings, a passion reflected in his rebuilding of the Pantheon in Rome, with its spectacular domed roof, and in his sprawling villa complex at Tivoli. The Wall was more functional, but it made up for this in sheer size.”

Only a single classical text, Historia Augusta, gives any hint to Hadrian’s motive for erecting the wall. Its purpose is described as “to separate the barbarians from the Romans.” That’s it. Historians have been left to deduce all the rest through archaeological finds and, more or less, context clues. The theories have typically centered on three main functions: to defend against pillaging raiders in border villages or invasions by the Scots or Picts (the barbarians of the day); to control and monitor who was coming in and out of the empire, like an ancient version of Customs and Border Protection; and possibly to tax those entering to generate revenue for the empire.

The wall endured for nearly three centuries and, despite the occasional small-scale invasion, had a pretty good run. Until it didn’t. As Goldsworthy wrote: “In the end, the Wall’s effectiveness would depend on the troops stationed on and around it.”

That’s the part, Frye said, that modern-day wall-builders like Trump can learn from. The wall didn’t collapse because of any single catastrophe or invasion, Frye said. It simply became useless once the Roman Empire could no longer sustain the military manpower required to guard it, lacking both the political will and resources to endure forever.

“A wall is not something you can just set it and forget it,” he said. “This holds true in both ancient times and modern times: A guarded wall tends to be very effective. An unguarded one is not.”

On Tuesday night, in his first prime-time Oval Office address, Trump will make his case for why he may declare a national emergency to build the wall, therefore bypassing Congress in a move that critics claim would be more akin to the decree of a king. The government has now been partially shut down for two and a half weeks because of the impasse over the border wall, as Democrats have refused Trump’s demands to pass a spending bill that includes $5.7 billion in funding for the wall.

Having abandoned his promised concrete wall, Trump has transitioned to proposing a “beautiful” and “artistic” steel-slat structure. Cost estimates since Trump took office have been all over the map, made more difficult with the shifting visions and materials. Estimates have ranged anywhere from $25 billion to $70 billion. (Trump’s tariffs on steel, as it turns out, would significantly increase the price for his wall, CNBC has reported.)

But what’s often left out of the debate is any discussion of long-term plans for how the federal government would maintain the barrier. A border-wall package would almost undoubtedly include a beefed-up Border Patrol to go along with it; the White House’s 2019 budget proposal called for an additional 750 agents, a small fraction of the total force. But the wall will also take years to build, meaning by the time it is completed or near completion a new administration may be in charge.

Frye, again, looks to history: After Hadrian died in A.D. 138, successors ignored Hadrian’s Wall for a few decades while focusing attention on a frontier farther north, leaving it to fall in disrepair as wall-crossers found their way around it. When future emperors decided to begin using the barrier again, they first needed more resources to restore the wall.

“My hunch is if we are to get a wall, it would certainly be manned and guarded as long as the Trump administration goes on,” Frye said. “After that, it’s a democracy. Who knows what happens?”