By the time O'Malley recovered from his wounds, the Civil War was over and he was transferred to Mountjoy Prison. During this period of imprisonment, he went on hunger strike for forty-one days, in protest at the continued detention of IRA prisoners after the war. During this time he was elected as a Sinn Féin Teachta Dála (TD) for Dublin North at the 1923 general election. He did not contest the June 1927 general election. He was one of the last republican prisoners to be released following the end of hostilities.