The Niners were the No. 1-ranked defense this past season under Ryans.
HOUSTON, Texas (KTRK) -- The Texans agreed to terms to hire San Francisco 49ers defensive coordinator DeMeco Ryans as their new head coach Tuesday, making them the first team in NFL history to hire three straight Black coaches.
The Texans and Ryans agreed to a six-year contract, sources told ESPN, to become the franchise's sixth full-time coach.
Ryans' hiring ends a three-week long coaching search since the Texans fired Lovie Smith on Jan. 8. Ryans, a former Texans standout linebacker, will be the fourth coach in Houston in four years after Smith and David Culley were each fired after one season.
The team will introduce Ryans on Thursday.
The former NFL linebacker reportedly interviewed with the Texans on Jan. 20, with a follow-up talk announced Tuesday. He was also linked to coaching vacancies in Denver and Indianapolis.
Ryans became a hot commodity on the head coaching market after leading the Niners to the No. 1-ranked defense in the league.
The Texans had eyes on a pair of Philadelphia Eagles coordinators: offensive play-caller Shane Steichen and defensive play-caller Jonathan Gannon, whom Schefter reports has strong support within the Texans organization.
Ryans becomes the third different head coach to be hired in as many seasons, replacing former coach Lovie Smith. Ryans inherits a pair of first-round picks, including the No. 2 overall selection, during this April's NFL Draft.
The 38-year-old Ryans, who was a star for Alabama, was drafted by the Texans 33rd overall in 2006, which was the same year Houston selected defensive end Mario Williams with the first overall pick.
Ryans outplayed Williams to become the unexpected star of the team in his rookie year, picking up an All-Pro selection and the Defensive Rookie of the Year award.
He went on to play six seasons in Houston, later picking up two Pro Bowl selections and also helping future superstar J.J. Watt acclimate to the pro game after he was drafted in 2011.
Ryans rounded out his 10-season NFL career by spending his final four pro seasons in Philadelphia.
Despite playing just one season together, Watt made sure he got his former team's attention about hiring Ryans by posting a photo of the two during their only year together.
ESPN contributed to this report.
SEE ALSO: Texans coaching search facing obstacles following 2 back-to-back coach firings after 1 season each