Like so many controversies in Washington, the case of a treehouse in a family’s backyard on Capitol Hill turned into a long, drawn-out saga — complete with disagreements between neighbors, reams of paper on arcane zoning and permitting regulations, allegations of government malfeasance, a claim of hacking to the FBI, and a federal lawsuit.

And after a five-year battle, it has ended.

The final agreement between the couple who built the treehouse for their two daughters and the city’s Department of Transportation came last month, after nearly three months of back-and-forth with a mediator during the coronavirus pandemic.

Both parties agreed that the treehouse will come down but not until early 2024. And by then, say Ellen Psychas and her husband, Bing Yee, their girls, ages 8 and 10, will have outgrown the castle-like play area and lost interest.

“We never planned to keep it forever,” Psychas said. “We’re fine with the agreement. We never planned to keep it until the kids were teenagers.”

The city agreed to drop $8,000 in fines against the couple over the years and promised no additional fines. Neither side admitted wrongdoing, and both agreed to avoid future litigation. The couple maintains that they complied with code requirements and that they don’t believe that the treehouse is “unlawfully occupying public space,” according to a settlement agreement filed in the U.S. Court of Appeals for the District of Columbia Circuit.

A certified arborist must oversee the removal of the treehouse when it does come down.

Dave Bloom, a spokesman for the D.C. Office of the Attorney General, said in an email that his office had no comment on the treehouse. A DDOT spokeswoman also said her office had no comment.

Denise Krepp, an advisory neighborhood commissioner who represents a nearby part of Capitol Hill, said she was glad the treehouse will stay a few more years and relieved the fight has ended.

“When I heard about the litigation I thought, ‘What a waste of time,’ ” Krepp said. “The city was dedicating lawyers to work to take down a treehouse, and we have so many other problems. That’s a woeful waste of money.”

Krepp said she always believed that the couple had followed “what they thought were the rules.” She said she respects them for keeping up the fight to save their daughters’ treehouse.

“They were good parents by showing their daughters, ‘This is wrong and we’re willing to fight it,’ ” Krepp said. “They were being good role models.”

Since the coronavirus pandemic hit, shuttering schools and closing playgrounds, Psychas said the treehouse has been a “godsend” to kids who live near the alley. At times, kids have played games — with pandemic-related safety protocols, she said — and used walkie-talkies to chat from the playhouse with others nearby.

But the battle to keep the treehouse has involved yelling matches at hearings, stop-work orders, appeals, letters of support and criticism, and accusations of tampering with online records — plus a lot of questioning of permitting and zoning rules in city codes.

The saga started five years ago when the couple wanted a play area for their young daughters, then ages 3 and 5. Psychas, who counsels high school students about college, and Yee, a Department of Homeland Security lawyer, have lived on Capitol Hill for 30 years and in their current house for more than a decade. They have said the city didn’t have specific rules on building treehouses. They checked with the District’s Department of Consumer and Regulatory Affairs and DDOT, believed a permit wasn’t required, then spent $1,500 to build the play area in a 100-year-old American elm tree over Labor Day weekend five years ago.

At the crux of the dispute is the 20 inches where the eight-foot-high treehouse hangs into the public alley over a mulched tree box. Over the years, the treehouse has divided neighbors on the U-shaped alley called Archibald Walk, near G and Sixth streets in Southeast Washington.

Because many of the homes on the street don’t have traditional front or backyards, the alley has become a public, shared space. Vehicles don’t use the alley, and neighbors often line it with flowerpots and benches.

At times, the family said, they have gotten bags of change in the mailbox with handwritten notes from kids that read, “Please don’t let anybody hurt the princess castle.” Tourists have also stopped to look at it.

The treehouse was the focus of nearly a dozen discussions and hearings at the area’s Advisory Neighborhood Commission, the city’s Public Space Committee and court hearings over whether to tear it down.

The couple asked to be grandfathered in when the city updated its codes, but the city denied their request. They filed a lawsuit in U.S. District Court that sought to keep the treehouse. When their complaint was dismissed, they appealed. In their suits, the couple accused DDOT officials of “permitting malfeasance and incompetence.”

The family also claimed that DDOT hacked into Psychas’s online city zoning account without her knowledge — a violation of a federal computer fraud and abuse act. Psychas and her husband filed a complaint with the FBI’s Internet Crime Complaint Center, but it went nowhere, she said.

The couple’s lawsuit ultimately went to a mediator who helped to broker an agreement this fall between the two parties. Psychas said the agreement is in “good faith,” and she and her husband will abide by it and take the treehouse down by the 2024 deadline.

Psychas said she and her husband stuck with the fight because they believed they had followed the city’s permitting instructions. And their kids had “become very attached” to it, she said.

“We promised them we’d keep the treehouse safe,” Psychas said. “This wasn’t just about our treehouse. It’s about homeowners who don’t have the wherewithal to fight back. We could and we did. It was an effort we valued.”

Time has healed wounds in the neighborhood. Krepp, the ANC commissioner, said most have moved on.

“People forgot about it,” she said. Plus, Krepp said, anyone who was “fiery” about it years ago probably realized “it’s just a treehouse.”