Two of Ben Olsen’s children look up to their father, who reached a deal with DCU executive Jason Levien, right. (By Steven Goff — The Washington Post)

A year ago, D.C. United would have been perfectly justified firing Ben Olsen. The decorated club had sunk to new depths of MLS misery, eventually finishing with a record-low three victories in 34 league matches.

On Monday, amid a renaissance that has taken United from worst overall to first in MLS’s Eastern Conference, the club presented Olsen with a new multiyear contract. The pact enters effect next season. Terms were not disclosed, but three sources familiar with the talks said the deal is guaranteed through 2019 and, in case Olsen is relieved of his duties during that period, he would remain with United in another capacity at a different salary.

With three victories in the final five regular season matches, United (14-9-6) would complete the greatest turnaround on a points basis in MLS history. D.C. has improved by 31 points; New York gained 39 from 1999 to 2000 (playing two fewer matches than the current MLS schedule and with a different point structure).

D.C. is three points ahead of Sporting Kansas City for the conference’s top seed in the playoffs and on the verge of advancing to the quarterfinals of the CONCACAF Champions League, an international tournament featuring clubs from North and Central America and the Caribbean.

“It’s a funny business, right?” Olsen said while his 3-year-old son, Oscar, hung from his left shoulder after the formal announcement at RFK Stadium. “It speaks to ownership’s loyalty. No one would have blamed them for getting rid of me, but they didn’t. I am sure there were reasons, including me being part of this club for a long time, that maybe kept me around.”

With United’s marked improvement and Olsen’s deal set to expire after this season, managing general partner Jason Levien opened negotiations with Bethesda-based agent Dan Segal in July. The sides reached agreement in principle a few weeks ago.

“He has kept the group together through adversity,” Levien said, “and he has the club poised for immediate and future success.”

The deal will continue Olsen’s continuous association with the club that began in 1998 as a rookie midfielder from the University of Virginia. After retiring in 2009, he was named an assistant coach. Midway through the 2010 campaign, when Curt Onalfo was fired, Olsen was appointed the interim boss. He was handed the permanent job starting in 2011. With four years in charge, Olsen is the longest-serving coach in United’s illustrious history. (Bruce Arena, Thomas Rongen and Peter Nowak, all of whom won MLS Cup titles, served three years apiece, as did Tom Soehn.)

Olsen’s deep, emotional ties to the District played into his desire for a long-term contract.

“I love this city. My [three] children were born in Washington, D.C., and I don’t want to move,” he said. “I told Jason in negotiations, ‘I don’t want to move. I want to be here. I want to be part of this club. I want my kids growing up in this city.’ Not the best negotiating tactic, but it’s true. From Day 1, I fell in love with this club. There was a lot to fall in love with early, and I feel a responsibility about pushing this club to the next level.”

At 37, Olsen is the second-youngest head coach in MLS behind Jim Curtin, 35, Philadelphia’s interim boss.

Olsen guided United to the 2012 conference finals but missed the playoffs in 2011 and last year, when it finished with a 3-24-7 record.

Both Olsen and General Manager Dave Kasper seemed in jeopardy of losing their jobs last year, but midway through the season, they outlined a plan to rebuild the club, a proposition that persuaded Levien and the other two investors to keep them on the job.

Olsen and Kasper refurbished the roster by acquiring several MLS veterans through the re-entry drafts and trades. For instance, Fabian Espindola is an MVP candidate, while Bobby Boswell, Davy Arnaud, Chris Rolfe and Sean Franklin have played major roles.

“We knew in June-July last year that we had no chance to make the playoffs,” Kasper said. “We mapped out a plan.”

Once the squad was assembled, Olsen had to make it work.

“I choose to look at [2013] as one hell of a learning experience and to evaluate who we are and how we want to go forward,” he said. “We turned the corner in a big way. Now, just like that, expectations have changed and now we are expected to win the East and go to the finals and get through CONCACAF. All of this goes to the business of being a head coach.”

He concedes he has “got a long way to go as a coach,” but with the new contract, he will have the time to do it.

“D.C. United has become my family and my identity,” he said. “It is where I belong.”