Goal revealed in July that City faced losing the Spanish midfielder, whose contract expires next summer, because they wanted to loan him out for this season, whereas his preference was either to play regularly for the Premier League champions or leave on a permanent deal.
In the past few months the 19-year-old has decided not to renew his contract as he believes will not be able to break into the City team anytime soon, and has now reached an informal agreement with Madrid.
The Spanish club will try to strike a deal with City to buy Brahim in January, although it is understood that there has been no official contact between the clubs yet.
Madrid have told the youngster that he will be part of the first-team set-up at the Santiago Bernabeu for the second half of the season, should they sign him in January.
If he performs well he is likely to remain part of the squad for next season, although a loan move is a possibility if he cannot establish himself.
That would leave many questioning the wisdom of moving to a top European club if first-team football is the aim, but sources close to the player insist it is a matter of belief.
Brahim is of the opinion that Madrid's attempts to sign him, and commitment to including him in the first team - unlike Brazilian wonderkid Vinicius Junior - is proof of their belief in him, and that he will ultimately be good enough.
He believes that City no longer share that belief, although the English side have long hoped that he would make the grade at the Etihad Stadium.
City signed Brahim from Malaga as a 14-year-old and saw him star for their youth teams before he was called up to the senior squad permanently by Pep Guardiola last season.
He earned a Premier League winners' medal last season thanks to five substitute appearances, and while he has started both Carabao Cup games this season - scoring two goals in the second - he is yet to make a match day squad in the league.
Barring a dramatic turnaround this leaves City facing the very real prospect of losing two of their three brightest academy hopes, having seen Jadon Sancho move to Borussia Dortmund in the summer of 2017.
Sancho also found himself in a contract stand-off with the club and moved abroad after City blocked a transfer to another Premier League club.
That leaves Phil Foden as the stand-out candidate to graduate from the academy to the first team.