* Court refers corruption case back to prosecutor
* Cases were brought after Shafik lost election to Mursi
* Former general has said he backs Sisi for president (Adds background)
CAIRO, Dec 19 (Reuters) - Former Egyptian Prime Minister Ahmed Shafik may soon be free to return home from self-imposed exile and perhaps to make a political comeback after courts on Thursday acquitted him in one corruption case and shelved another.
Judicial sources said the court had sent the final case against Shafik, the last prime minister to serve under deposed President Hosni Mubarak, back to the prosecutor.
He must now decide whether to dismiss it or order more investigations into the charges, which relate to illegal allocation of state-owned land.
A separate court acquitted Shafik and Mubarak's two sons, Alaa and Gamal, in a different corruption case. The prosecution has not said whether it will appeal that ruling. Alaa and Gamal Mubarak remain in prison charged with other corruption cases.
The ruling means Shafik's name will be removed within days from a list of people whose arrest has been ordered.
Several corruption cases were brought against Shafik last year after his presidential election defeat by the Muslim Brotherhood's Mohamed Mursi, who has been in detention since the army unseated him on July 3 after mass protests.
Shafik, a former air force commander, left Egypt soon after Mursi's victory was announced. Mursi was referred to trial on Wednesday, together with 35 other leading Islamists, on charges of terrorism and conspiring with foreign groups.
In an interview in September, Shafik said he would not run for the presidency if army chief General Abdel Fattah al-Sisi did, saying the man who toppled Mursi had his full support.
Sisi has yet to say whether he will run or not. He enjoys wide support among those Egyptians who were happy to see the end of Mursi's rule, but has been reviled by the ousted president's supporters who call him the mastermind of a bloody coup.
Mubarak himself was released from prison following Mursi's removal. He has been at a military hospital since he was freed, and still faces a retrial on charges including ordering the killing of protesters in the 2011 uprising that removed him. (Reporting by Yasmine Saleh and Tom Perry; Editing by Alistair Lyon)