Labour Leader Ed Miliband took part in talks to bring Lutfur Rahman back into the party, the High Court has heard.
The Tower Hamlets mayor said he heard there was "a pathway" for him back to the group following his election win in 2014.
He added this was thwarted by the election petition currently taking place, in which the mayor is accused of corruption, including overseeing election fraud and smearing his rival as a racist.
Mr Rahman, who lost his place in the party after standing as an independent in the 2010 mayoral vote, said: "There were senior discussions with the union Unite, Ken Livingstone, [MP] Keith Vaz and others within the Labour leadership, as high up as Ed Miliband, to return me to the party and unite the party locally.
"Post election discussions had already started. We were confident within two to three months we would get a pathway to return but the proceedings then started."
Mr Rahman, who denies the allegations against him, stood as an independent after being excluded from the Labour selection, following a dossier alleging links with Islamic fundamentalists being presented to the party.
"I strongly believe (the election petition) was a mechanism like 2010 - this was aimed to do the same thing," he said.
The mayor went on to say he felt the London Labour Party did not support him when he became leader of the Tower Hamlets Council in 2008.
He added he felt this was "because I'm Bangladeshi, because of my colour".
However, he added he would still like to return to the party. "With the national Labour Party I didn't see much of a problem," he said.
Mr Rahman went on to say he believed he was not readmitted to Labour earlier because of the allegations he was corrupt. "But nothing was proven," he added.
Earlier in Wednesday's session the mayor was accused of using spiritual influence to secure support from Muslim voters.
The court heard an imam urged people to vote for him and said during prayers at a wedding, in which the Mr Rahman was present, "we will celebrate the mayor's win".
The mayor responded on the allegations: "That's disgusting. I wouldn't associate with anyone who used religion in an election."
The hearing continues.