Following the end of the Last Great Time War, the Time Lords eventually unfroze Gallifrey and moved it from the pocket universe it was located in to "the end of the universe, give or take a star system". As Lord President, Rassilon worried about the Hybrid that was prophesied to conquer Gallifrey and stand in its ruins. Believing the Twelfth Doctor knew who the Hybrid was, Rassilon set up a deal with Ashildr to capture the Doctor and trap him in his confession dial. (TV: Hell Bent) This led to the death of the Doctor's companion Clara Oswald. (TV: Face the Raven) The Doctor spent four and a half billion years trapped in the confession dial, (TV: Hell Bent) eventually escaping and arriving on Gallifrey. Enraged by Clara's death and determined to save her, the Doctor had a young boy inform "someone in charge" that the Doctor had arrived and knew what they did (TV: Heaven Sent) before making his way to the barn he slept in often in his youth. (TV: Hell Bent)
After learning of the Doctor's arrival, Rassilon sent a gunship to arrest the Doctor, but the Doctor ignored the soldier's commands to surrender, drew a line in the sand between them and returned to his soup. Rassilon then sent a squad of soldiers led by the General and the High Council to speak with the Doctor, but he just went back into the barn without a word each time.
After Ohila informed Rassilon that the Doctor didn't blame Gallifrey for the horrors of the Time War, but rather Rassilon himself, Rassilon travelled to the barn where the Doctor finally came out to greet him. When Rassilon tried to shake his hand, the Doctor dropped his confession dial at his feet and ordered him to "get off my planet" despite Rassilon insisting that his actions were necessary due to the threat of the Hybrid. When the Doctor refused to relent, Rassilon ordered his firing squad to kill him despite the General's protests as many of the soldiers had served with the Doctor in the Time War and respected him greatly. Rassilon still ordered the Doctor's execution, but while the squad fired, they purposefully missed.
Confronted by Rassilon over their failure to kill an unarmed man, Gastron told him a saying regarding the "Doctor of War" during the Time War, that the first and last thing people saw was usually that he was unarmed. Gastron then dropped his weapon and stood with the Doctor, having fought at his side before. One by one, the firing squad dropped their weapons and join the Doctor while Rassilon berated them and the General watched, seemingly not choosing sides. Finally, Rassilon decided to use his gauntlet against the Doctor, to force him to regenerate until his final death, but stopped when four gunships arrived. Rassilon was pleased, believing the General called for backup, but the Doctor revealed that he used his sonic sunglasses to call the ships who also stood with the Doctor.
Rassilon was unable to believe that everyone turned against him due to his high position in Time Lord society. Rassilon tried once more to kill the Doctor himself, but the General finally sided with the Doctor, telling Rassilon "Lord President, with respect, get off his planet." The General then dropped his own gun and stood beside the Doctor along with all of the other military present. Rassilon, now with no allies, surrendered and was exiled from Gallifrey by the Doctor, now Lord President after deposing Rassilon. (TV: Hell Bent)
With Rassilon banished, the Doctor became the Lord President of Gallifrey. The Doctor also banished the High Council as well for their role in his imprisonment. The Doctor offered his help in finding the Hybrid to the General and Ohila; however, this was a trick so the Doctor could save Clara Oswald. (TV: Hell Bent)