CLEVELAND (AP) — Mike Brown and the Cavaliers are getting back together.

Brown, who led the Cavs to the playoffs in all five seasons he coached them from 2005-10, has agreed in principle to a contract to return as their coach for a second time, a person with knowledge of the situation told The Associated Press on Tuesday.

READ MORE: LA County To Consider $10K Reward For Information In Tioni Theus Killing, Teen Found On Side Of 110 Freeway

Brown hasn’t yet signed his new deal, but has agreed to take the job, according to the person who spoke on condition of anonymity because negotiations were ongoing. Brown’s hiring could be announced as early as Wednesday.

The sides are working through the length of the deal and other matters, but Brown’s back with the team he guided to its greatest successes.

“I’m happy for him,” said Miami’s LeBron James, who played in Cleveland under Brown. “Very happy for him. I think he’s a really good coach, very defensive-minded coach. It’ll be good for those young guys that they have.”

Brown went 272-138 and went to the playoffs every season with the Cavs, teaming with James on a run to the NBA Finals in 2007. He was fired by owner Dan Gilbert after the Cavs lost to Boston in the 2010 Eastern Conference semifinals, shortly before James decided he was leaving Cleveland as a free agent.

Brown spent one full season with the Lakers, but was fired by Los Angeles five games into this season.

The Cavs have been without a coach since firing Byron Scott last week following his third straight losing season.

One of the main factors in Brown’s decision to come back to Cleveland was that he had already planned to move his family back to the area, long before Scott was fired. Brown is also close friends with Cavaliers general manager Chris Grant.

Brown met with Gilbert and Grant on Sunday in Detroit and negotiations intensified. Gilbert reached out to a few other high-profile coaches, including Phil Jackson. But Jackson had no interest and the search quickly zeroed in on Brown, who was the only candidate to be interviewed.

The Cavs knew they had to act quickly to snare Brown before they were in competition with other teams to sign him. Phoenix reportedly reached out to Brown about their vacancy in recent days, and other teams were expected to contact the 43-year-old.

And now that Brown is back in Cleveland, it remains to be seen what impact that could have on James one day returning to the Cavs. He can opt out of his contract with Miami next summer, and there has long been speculation about him coming back home to play in Northeast Ohio.

Last week, James positively touted Brown’s possible return to Cleveland.

READ MORE: Memorabilia Used By Paul McCartney, BTS, Tom Petty & More Featured In MusiCares Charity Auction

Beyond his stellar record and postseason triumphs, Brown also helped build a winning foundation with the Cavs. It certainly helped that James was around, but Brown instilled a winning attitude and defense-wins belief in his players.

Scott was fired last week after three seasons following a 24-win season and with one year left on his contract. Scott was strapped with a young, inexperienced squad but owner Dan Gilbert didn’t think the Cavs made adequate progress — especially on defense — with him so he’s handed his team back to the same coach he fired three years ago.

Brown’s return to Cleveland isn’t really all that surprising.

The Cavs wanted a successful, defensive-minded coach and they had their greatest success in five seasons under Brown, who was certainly helped by having James on his teams. But he has made the playoffs in all six seasons as an NBA head coach, and shown the ability to develop younger players during his first stint with Cleveland.

The Cavs won at least 45 games each season during Brown’s tenure and went 66-16 in 2008-09 when he was named NBA Coach of the Year.

His teams in Cleveland always played solid defense, ranking among the top in most categories. James has credited Brown with making him a better defensive player and getting him to understand the importance of defending the basket. Brown, though, was criticized for a stagnant offense that too often relied simply on James’ marvelous athletic skills, especially late in games.

Brown was fired by Gilbert after the Cavs were beaten in the 2010 playoffs by Boston. James was accused of quitting on the team during that series and there was tension in the final weeks between the league MVP and his coach.

But Brown’s firing was more about Gilbert trying to make James happy and persuade him to re-sign, a strategy that ultimately didn’t work when the superstar went to Miami.

Brown left Cleveland on good terms, which would take some of the awkwardness out of his return.

Even before Scott’s firing, which seemed inevitable as the Cavs staggered to the end of the season by losing 16 of their last 18, Brown was looking for houses to return to Cleveland. He’ll be closer to his oldest son, who will be a freshman basketball player at Butler next season and his younger son intends to finish high school with friends he made when his dad previously coached the Cavs.

Brown is inheriting a team with a bright future. As long as he can stay healthy, All-Star guard Kyrie Irving will only improve and in Anderson Varejao, Dion Waiters, Tristan Thompson and Tyler Zeller, the Cavs have a solid nucleus.

MORE NEWS: LAUSD To Require Surgical-Grade Masks For Students Beginning Monday

Cleveland has two first-round picks in June’s NBA draft, the team has plenty of salary-cap space and Grant said last week that he intends to be aggressive in free agency this summer.