Politics is "all about seizing moments", Ed Miliband told the Observer earlier this month. So when the biggest opportunity of his life came along he felt he had no choice but to take hold of it.

It was an extraordinary decision – to take on his own brother in the battle for the leadership of the Labour party. But he knew another chance might never come, and nobody wanted a repeat of the famous Granita deal that seeped poison into the party through the Blair-Brown years.

"Am I really not going to stand because my brother is standing? If he wasn't in the race I would not have had any hesitation," said Ed.

All his life he had walked in the footsteps of his brother, who isolder by four years. First there was school – the comprehensive in north London, which they both credit for instilling in them the values they hold today.

Then the younger Miliband followed his brother to the University of Oxford, where he chose not only the same course, but the same college. Finally he joined David in the House of Commons as a Labour MP and soon sat around the same table as him as a cabinet minister – the first time brothers have done so since before the second world war.

The result means that Ed Miliband has leapfrogged his brother for the first time. Hours before the announcement the race had been described as being on a knife-edge, with headlines declaring it "too close to call".

At the last moment – on Friday afternoon – the bookies switched their call from David to Ed. And they were right.

Ed Miliband was born on Christmas Eve, 1969, son of influential Marxist intellectual Ralph Miliband and teacher Marion Kozak. His father, a Polish Jew, had fled the Nazis on the last boat to England from Belgium.

The brothers grew up in a home that was filled with political chatter as intellectuals came and went, often calling on the boys to pitch ideas and join the debate. Among their parents' friends was Tony Benn – whom Ed worked for as an intern.

The couple sent their sons to nearby Haverstock Comprehensive, in north London, a school that has been described as Labour's Eton. There they met Oona King, the former Labour MP who this week missed out on her chance to run as Labour's candidate for London mayor.

Ed says his experience of studying Philosophy, Politics and Economics at Corpus Christi College, Oxford, was very different from David's. It was there that his activist streak grew. He has described his favourite four weeks at university as the time he was involved in a rent dispute with the college – claiming that "politics always motivated me more than academia".

There was a brief stint as a television researcher before he went to work for Harriet Harman (who had called the Observer's Andrew Rawnsley to ask if he would recommend the bright, young, leftwing man who had worked with him).

Miliband junior went on to work at the Treasury with the chancellor and was soon an undisputed Brownite. In the days that the relationship between the two camps became most strained Ed was seen as the one person who could span the warring tribes – perhaps down to his relationship with his brother. He had also dated Liz Lloyd, who had worked for Blair and was a close friend of James Purnell.

Blairites nicknamed the younger Miliband the "emissary from the Planet Fuck".

He and David remained close and even lived in flats in the same house in Primrose Hill, north London, near to where they had grown up. The older Miliband became an MP and Ed spent a year lecturing at Harvard university, in the US.

The decision then to follow his brother once again this time into parliament was a difficult one. Friends said that even then Ed was wary of being in his brother's shadow.

That was soon to change. After being elected as MP for Doncaster North in 2005 he rose quickly through the ranks of the Labour government. In 2008 he was appointed as secretary of state for the newly created Department of Energy and Climate Change.

Clearly rated as a politician, Miliband took the lead on the Labour government's 2010 manifesto – a role that brought praise and criticism.

Along the way he and his partner, Justine Thornton – a barrister – had a son, Daniel, and now have a second child on the way.

When Ed decided to take on his brother for the leadership there were some fears that a Shakespearean battle doomed to tragedy would unfold. With one brother considered an arch-Blairite and the other reared by Brown, some expected a return to the bitterness of the past.

Both resisted the temptation – but the relationship was clearly stretched at times, with their mother, who still lives nearby, said to be upset. They both say blood is thicker than politics – but friends have reported frosty encounters.

It cannot have been easy for David, the older brother – always ahead – to watch Ed chase him all the way through the race and then become favourite with one day to go. Nor to stand on stage as he took the ultimate prize that so many had expected to go the other way.

But this was the one thing in their lives that the Miliband brothers could not do together. And in the end this was Ed's moment.