The Boston Celtics announced Wednesday that Danny Ainge is retiring and coach Brad Stevens is being promoted to president of basketball operations.

The Celtics will start a search to hire a head coach to replace Stevens. Ainge will work with the team on the transition through the offseason. Ainge has been contemplating leaving the job for several months and had been talking about possible succession plans with ownership, according to sources.  Stevens, who has been coach for the past eight seasons, has been described as worn down with coaching since The Bubble and welcomed the chance to make the transition to the front office, sources said.

Owner Wyc Grousbeck, who hired Stevens in 2003, told reporters that he and Stevens agreed “to win Banner 18, or die trying.” The move comes a day after Boston’s disappointing season came to an end in a loss to the Brooklyn Nets in Game 5 of their first-round playoff series in Brooklyn. “I’m grateful to ownership and to Danny for trusting me with this opportunity,” Stevens said in a statement. “I’m excited to tackle this new role, starting with a wide ranging and comprehensive search for our next head coach.”

Ainge, 62, was the architect of Boston’s last title team, the 2008 squad featuring Paul Pierce, Kevin Garnett and Ray Allen, and was the third-longest-tenured active lead executive of any NBA franchise, trailing only longtime nemesis Pat Riley with the Miami Heat (1995) and Gregg Popovich with the San Antonio Spurs (1996). The Celtics are headed into what is a pivotal offseason for the franchise after Boston finished seventh in the Eastern Conference on the heels of making it to the conference finals three of the past four years. After years of having surplus draft picks and the opportunity to make moves in free agency, the Celtics find themselves without either this offseason.

Kemba Walker, the team’s highest-paid player, has two years and $73 million remaining on his deal, and he is coming off a season that saw him miss 29 games — plus Boston’s final two playoff games — with knee issues. Marcus Smart, the team’s emotional leader, is entering the final year of his contract and is extension-eligible. And Evan Fournier, whom Boston acquired at the trade deadline after using a significant portion of the trade exception created when Gordon Hayward departed in free agency last offseason, will be an unrestricted free agent.