What’s the best way to invade Washington, D.C.? It can make for some interesting speculation amid the peace of today. Or for some dark visualization, as in Alex Garland’s recent film Civil War, which imagines a second instance of bloody internecine conflict on American soil.

But during the first and — so far — only civil war this country has seen, an invasion of Washington was no idle matter. Early in the Civil War, especially, it was a live possibility, and near the war’s end, it came frighteningly close to reality. The story of why it never did, often overlooked amid the war’s epic battles and larger-than-life characters, deserves attention. It is told throughout the city and the surrounding area, in a series of sometimes out-of-the-way and often nondescript plots of land that once hosted the forts that defended the city.

In 1860, those defenses were meager, consisting solely of Fort Washington, well south of the city along the Potomac River. But even before the war commenced, it was becoming clear that Washington was uniquely vulnerable and an obvious target for the Confederacy. “The Confederates did have desires to take the city,” says Bryan Cheeseboro, a ranger in the National Park Service who specializes in the history of the forts (and grew up near one of them, Fort Stevens). “Newspapers had articles with stories about how we must take the city, we can’t allow the government to be seated there.”

Further fortification began quickly as war broke out: first around the White House and the Capitol, then in northern Virginia. In July 1861, the debacle of the First Battle of Bull Run not only shattered Northern hopes for an early end to the war and sent a humbled horde of Union troops back to Washington. It also kicked the effort to defend Washington “into high gear,” says Gary Thompson, president of the Alliance to Preserve the Civil War Defenses of Washington, which works to keep the forts and their memory alive.

The man most directly responsible for standing up the forts was John Gross Barnard, chief engineer of the Army of the Potomac. Under Barnard’s watch, the defenses of Washington grew quickly. By 1865, they were a 37-mile ring of 68 earthwork forts, linked by 20 miles of rifle pits, 32 miles of military roads, and 93 detached batteries for guns, with 1,501 field and siege guns inside the circle itself.

A National Park Service pamphlet about the defenses describes the Washington of that era as “one of the most heavily fortified locations in the world.” The forts played an essential role during the war in training troops for campaigns elsewhere and in keeping the city safe. “The fortification system was the key to the Union, the United States of America, winning the war and eradicating slavery,” Thompson says. “Without this fortification system, there would not be a United States as we know it today.”

The area these forts defended was quite different from D.C. as we know it today. It consisted of three separate jurisdictions: Washington City, with the White House, the Capitol, and their vicinities; Georgetown; and Washington County, the rural stretch beyond Washington City. The Washington Monument and Capitol Dome were incomplete. A canal stretched across the National Mall. Farm animals were not an uncommon sight, even in the city portion of the District; in harsh rains, the streets became mud. The whole area had only 75,000 residents, some 60,000 in the city itself. Thousands of Union troops poured into the city over the course of the war, initiating its transformation. The forts were often one of their first stops. Many fresh recruits were set to work digging ditches at them as one of their first tasks. And though fort duty meant at least a temporary reprieve from the fighting (with one notable exception), many of their soldiers wished to be at war and found their time at fort a bore. “It was horrible. . . . It was muddy, you were exposed to the elements, it was digging, marching, and drilling. And frustration,” Thompson says. He describes much of their correspondence as being to the effect of, “I thought I was going to fight a war but I’m sitting here. I don’t even know where I am. They call this place Fort Dupont, I’m across the Anacostia River, and I’m sitting here, and there’s mosquitoes, and it sucks.”

The soldiers were kept busy at the forts or soon sent off to other campaigns. But contemporary accounts nonetheless relate tales of military laxity due to the distance of combat. As Ernest B. Furgurson observes in Freedom Rising: Washington in the Civil War, “when the war was being fought fifty or a hundred miles distant and off-duty temptations were so close in Alexandria and Washington, the discipline of those outfits sometimes slipped.” Records exist of soldiers’ stealing peaches from orchards and pilfering whiskey from wherever it could be found, and of well-to-do Washington families’ demanding that the soldiers be made to behave better.

Before war’s end, however, the sometimes restless troops in Washington would have their discipline tested. In July 1864, a considerable Confederate force under Jubal Early and John Breckinridge (the latter once vice president of the United States, and a candidate for president against Lincoln in 1860) approached Washington. As they neared (following an essential strategic delay at Monocacy, courtesy of Union forces led by Lew Wallace), rumors flew about the city while actual information about their approach was suppressed. But from atop Fort Reno, the highest point in Washington, the reality of the Confederates’ designs became obvious.

Their timing was fortuitous. Ulysses S. Grant, now commander of the Union army, had summoned troops southward for his Petersburg campaign, leaving the forts nearly empty. But as Early approached Fort Stevens, today in north-central D.C., there was a scramble to fill its positions with everyone from local boys to farmers and old fellows. Even government employees showed up. “If you can imagine such a thing today as, ‘Okay, everyone at the IRS, get your rifle and go to one of the forts,’” Thompson says. The presence of one government employee was particularly notable: Abraham Lincoln himself. On July 11, President Lincoln visited Fort Reno. On July 12, he went to an active battle site at Fort Stevens. Lincoln, standing near one of the fort’s parapets, came under fire. Confederate sharpshooters did not seem to know who he was. But a surgeon standing next to him was shot before someone (accounts differ concerning who it was) told him to get down. He obliged.

During that key battle, the forts did what they were supposed to do. “Every appliance of science and unlimited means had been used to render the fortifications around Washington as strong as possible,” Early observed. He called them “exceedingly strong” — too strong, at any rate, for him: A sufficient show of force from Fort Stevens and nearby forts (bolstered by the arrival of Grant-sent troops) eventually repulsed Early’s force, which failed to make an expected foray on July 13.

The Battle of Fort Stevens was the high-water mark of the forts’ involvement in the Civil War. Some were deactivated while the war continued. Most of the rest fell into disuse shortly thereafter. About 20 were kept in use, until by the 1870s it became clear they were not needed. Elements of them were sold off and even scavenged. They began to melt into the surrounding cityscape. The forts had helped transform the city, but the transformed city had left them behind.

Their preservation was, initially, haphazard. Elizabeth Thomas, a free black woman who was one of many from whom land had been seized for the city’s defenses (hers for Fort Stevens), played an early role in proclaiming the area’s significance when her land was returned to her. Cheeseboro calls her the forts’ “first tour guide.” But not until 1902 was there any official government recognition that they might have some historical value. That came via a report of the McMillan Commission, which proposed a parkway connecting the remaining forts. This never came to pass, though it was discussed as late as the Kennedy administration. Most other attempts to preserve the forts were sporadic. Thus, what remains of them is mostly accidental. The most dedicated efforts at preservation have been centered around Fort Stevens. Veterans of the battle pressed hard for its rehabilitation. By the 1930s, a portion of it had been restored to something like its original character. Today, a visitor can observe cannons in fighting position behind wooden parapets atop rolling hills, a ringed defensive ditch, an American flag, and a stone commemorating Lincoln’s presence at the battle. The National Park Service has asserted its jurisdiction over some of the forts, as have municipalities in Maryland and Virginia. The forts are in various states of preservation and resemblance to their original design. Though there is ample signage, many of the original sites can be difficult to distinguish from their surroundings. Their vicinities have not completely forgotten them, however. It is hard to find much left of Fort Carroll, for example, but a nearby market has taken its name. Fort Davis has lent its name to a strip mall across Alabama Avenue and to the neighborhood in which it sits. And in the woods, meshed in the undergrowth, is a stone from the 1950s designating Fort Davis’s former site.

The surrounding area is also a park. It’s a common fate for these former forts. Some of them even have playgrounds. Fort Stanton is now a full-blown recreation center, with a swimming pool, sports fields, and an indoor basketball court (the bored soldiers of the Civil War might have enjoyed such amenities). Cheeseboro is heartened by the fact that some of these forts have gone “from a place where we’ve built this fort in the case of an attack, and the fort never really saw any action, so the defenses worked,” to now being “not only places of complete peace, but places of play, where children can play, feel safe, enjoy their childhoods.” Fort Greble Park even has features — a “mess hall” for picnics, a watchtower with viewfinders, miniature fortifications alongside — designed to evoke its past. Outside of Fort Stevens, the best-preserved fortifications tend to be protected by forest. Within a circle of trees at Fort Circle Park, something resembling a mountain-bike course — a circular dirt path traversing a series of small, rolling dirt hills, ringed by an outer ditch and marked by a flat inner plateau — makes obvious that the area once housed Fort Dupont. A journey into deeper woods in Rock Creek Park on the other side of town, near Gary Thompson’s home, reveals Fort DeRussy. It would stand out from its clearly artificial earthen mounds and surrounding ditches even if it were not amply marked. Virginia’s Fort Ethan Allen maintains much of its original earthworks, as well as a helpful photo on-site that compares what today is an open, grassy field with the elaborate fortifications that once stood in the same place. Other sites have accumulated new history since the war’s end. Fort Reno, where “no visible evidence remains” of its former use, according to its signage, has become a popular sports and recreation venue. With its vast open spaces and a prime vantage point over the city whose military utility is intelligible even to the modern visitor, it remains an attractive spot for locals. D.C.-area post-hardcore band Fugazi once played a concert there. Battery Terrill is now on the property of the Peruvian ambassador’s residence. In Virginia, what remains of Fort Richardson is now part of the golf course at the Army Navy Country Club. And Fort Marcy saw its most famous casualty nearly 130 years after the Civil War ended, when Clinton associate Vince Foster committed suicide there.

Today, the clearest efforts at memorialization within D.C. limits are centered around Fort Stevens and the nearby Battleground National Cemetery, a burial site for the fort’s dead. The fort site hosts an annual celebration of Fort Stevens Day, a reenactment-laden memorial of the battle held on or near its anniversary (this year on July 13). The cemetery sees commemorations on Memorial Day. Taken together, the forts and their remembrances are a welcome, if modest, tribute to an underappreciated aspect of Civil War history. When historians debate what the most important thing in the war was, responses will vary, Thompson says. Gettysburg. Vicksburg. But “nobody ever says the Civil War defenses of Washington.” Perhaps more should. Or at least should learn more about them. For one, their vantage points, many atop hills, not only afford a great way to see the city. They also induce a sense of historical understanding as to why Washington was a military target. It is fascinating, for example, to realize that artillery fired from Fort Totten and Fort DeRussy could reach Fort Stevens (well over a mile away from each) and beyond, as it did during the battle.

And all of this can be learned without going to some of the other, more famous battlefields also reachable from Washington. “You can go to Gettysburg, and nothing against Gettysburg, Antietam, any of those places. Great places to go, places I’ve been. Love to go there, love to go back,” Cheeseboro says. “But you can learn a lot of Civil War history in Washington, D.C.” Indeed. May the forts endure as reminders, for us, of what dangers we once faced — and, one hopes, may never face again.