Even after being caught out he claimed had had been in the UK paying bills all along, claiming it was "not a made-up story".
Qoomaal pleaded guilty to two counts of dishonestly failing to notify a change of circumstances regarding Pension Credit and Housing Benefit between August 20, 2013 and February 22, 2016.
Incredibly, Qoomaal, of Archery Close, Harrow, north-west London, continued to receive benefits, minus a £44 per-week deduction to compensate the Department of Work and Pensions (DWP), while his case was pending.
At that rate it would have taken Qoomaal, who has heart and renal issues, 17 years to repay the £38,869.97 total.
He also needed a taxpayer-funded interpreter during eight court hearings.
Isleworth Crown Court Judge Jonathan Ferris asked: "Why does he live here? Why is he entitled to benefits? What's he doing here?
"He can't have made much of a contribution to the pension credit he is receiving."
Prosecutor Miss Lisa Matthews said: "He failed to notify the fact he was living abroad in Somalia and in order to mislead investigators he fabricated an immigration stamp in his passport."
The court heard Qoomaal wanted to live in a warmer climate for health benefits and only returned to the UK when he heard he was wanted for questioning.
The prosecutor added: "He left the UK on an open ticket and did not return. He gave the keys to his privately-rented flat to a third party, who lived there while he was abroad."
When quizzed Qoomaal tried to lie his way out of trouble, but finally confessed when his legal representative informed him the evidence was overwhelming.
He is currently on medication and has a series of hospital appointments with departments specialising in cardiology, dialysis and infectious diseases.
His lawyer Miss Mariska Van Leeuwen said: "He also has problems with his legs. He had a heart attack last year and another this year and he has a vast amount of medication with him."
Qoomaal claimed asylum on the basis he was in danger in his homeland, but this did not prevent his return trip, where he received his benefit money via Western Union transfers from an accomplice.
Judge Ferris asked: "He's just gone back there, how does that work? He came here as a refugee 15 years ago and then goes back to Somalia to enjoy the nice weather.
"Someone was living in his flat that the public purse paid for or it was rented out."I don't see why a person who took nearly thirty-nine thousand pounds and went to another country and fabricated an immigration stamp on his passport should not go to prison immediately.
"What ties does he have in this country apart from the benefits system."
The judge told Qoomaal: "You came to this country as a refugee and enjoyed the benefits of this country as a British citizen, which you became.
"With that comes certain responsibilities and certain consequences for someone who breaks the law as you have done."In a desperate attempt to avoid jail Qoomaal applied to change his plea to not guilty, resulting in several more costly court hearings.
He claimed: "I was in the country, I was paying bills. I'm not lying. It's not an illusion, it's not a made-up story.
"At the DWP the Somalian interpreter was not in my dialect. I did not understand and they were not saying what I was saying.
"The lawyer pressured me to plead guilty and I did not understand 'guilty'. I thought it was something that makes you free."
Judge Ferris told him: "The offences are aggravated by your attempt to avoid responsibility by the false stamp on your British passport.
"You have also made an elaborate and utterly hopeless application to change your plea, which has resulted in at least four additional court hearings."