PHILADELPHIA — Amid one of the worst stretches of basketball in NBA history, the Philadelphia 76ers have signed Coach Brett Brown to a contract extension.

Brown’s original four-year deal was set to expire after next season.

Brown said he always wanted to stay in Philadelphia, even as the franchise was gutted of talented, veteran players for a shot at building a winner through lottery draft picks.

He has two losing streaks of at least 26 games on his resume. Brown and the 76ers went 19-63 in 2013-14, 18-64 last season and carried a 1-22 into Friday night’s game against Detroit.

The front office loves Brown’s teaching, patience, and leadership in guiding the team through the worst era for a franchise that last won a championship in 1983.