US President Barack Obama's former chief of staff Rahm Emanuel was allowed by the Illinois Supreme Court to run for Chicago mayor after a lengthy legal battle. Emanuel,who got his name temporarily back on the ballot on Tuesday had been denied by Illinois Appellate Court in a 2-1 ruling to run for mayor as he did not meet residency requirements. He was in Washington D C for the last two years to serve the Obama administration and had not lived in Chicago for a full year. However,the Chicago Board of Election Commissioners had permitted Emanuel to run for mayor. According to an 1871 state law,mayoral candidates are required to stay in the city for a year before the elections. Emanuel took part in a debate tonight on WGN TV with other contenders for the February 22 mayoral election. The North Side Congressman for six years had not stopped campaigning even after the appellate court ruling. "Given the record before us,it is simply not possible to find clearly erroneous the (Chicago Board of Elections') determination that the objectors failed to prove that the candidate had abandoned his Chicago residence," the court ruled in an unanimous decision. "We therefore reverse the decision of the appellate court and affirm the decision of the circuit court,which confirmed the Board's decision," it added. Emanuel started campaigning for mayor in October last year after the longest-serving Chicago mayor Richard Daley announced in September that he would seek another term. Daley has been Chicago mayor for 22 years and will end his term on May 16.