CHICAGO -- Illinois' highest court put Rahm Emanuel back in the race for Chicago mayor Thursday, three days after a lower court threw the former White House chief of staff off the ballot because he had not lived in the city for a full year.

The state Supreme Court ruled unanimously in Emanuel's favor, saying an appeals court decision that said the candidate needed to be physically present in Chicago was "without any foundation in Illinois law."

"As I said from the beginning, I think the voters deserve the right to make the choice of who should be mayor," Emanuel said shortly after getting word of the high court's action. "I'm not quite sure emotionally where I'm at."

When he learned of the ruling, Emanuel said he immediately called his wife and took a congratulatory call from his old boss, President Barack Obama.

In a 7-0 decision, the Illinois Supreme Court called the appellate court's Monday decision "fundamentally flawed" and said the judges were not "justified in tossing out 150 years of settled residency law in favor of its own preferred standard." (Read the Supreme Court decision here.)

From Thursday's ruling (emphasis added):

Although adopting a previously unheard-of test for residency that would have applied to all future municipal elections, the court made no attempt to explain what its standard means. The only hint given by the appellate court is that, whatever its standard means, this candidate did not satisfy it. The appellate court never explained what it meant by "actually reside" or "actually live." Indeed, as its discussion of section 3.1-10-5(d) reflects, the entire appellate court opinion can be read as nothing more than an extended exercise in question begging, in which the appellate court sets forth the question to be answered as what it means to "reside" (No. 1-11-0033, slip op. at 11), and concludes that it means to have "actually resided" (No. 1-11-0033, slip op. at 21). "

Emanuel, who has said he always intended to return to Chicago and was only living in Washington at the request of the president, had asked the Supreme Court to overturn the appeals court ruling. Within minutes of the ruling, Emanuel was at a downtown Chicago public transit station shaking hands with residents.

He never stopped campaigning as the controversy evolved. His spokesman said Emanuel was en route to the campaign appearance when he received word of the ruling and was scheduled to participate in televised debate Thursday evening.

In their appeal, Emanuel's attorneys called Monday's appeal court ruling "one of the most far-reaching election law rulings" ever issued in Illinois, not only because of its effect on the mayoral race but for "the unprecedented restriction" it puts on future candidates. (Read the appellate court decision here.)

His lawyers raised several points, including that the appeals court applied a stricter definition of "residency" than the one used for voters. They say Illinois courts have never required candidates to be physically present in the state to seek office there.

Emanuel, who has been leading all of his opponents in fundraising and in polls, was confident that the Supreme Court would reverse Monday's decision.

"I am clear that I think that we will succeed because of the thoroughness of our argument," he said Tuesday at an event where he received an endorsement from the Teamsters. He said he was "more determined to see this through so the people have a right to make the choice for themselves."

The residency questions have dogged Emanuel ever since he announced his candidacy last fall. Emanuel tried to move back into his house when he returned to Chicago but the family renting it wanted $100,000 to break the lease and move out early. The tenant, businessman Rob Halpin, later filed paperwork to run for mayor against Emanuel, only to withdraw from the race a short time later.

The Supreme Court was also impressed with Emanuel's testimony before the city's election board in which he listed all the personal items in the house he rented in Chicago when he moved to Washington - including his wife's wedding dress, photographs of his children and clothes they wore from the hospital as well as items belonging to his grandfather.

"The Board determined that, in this situation, the rental did not show abandonment of the residence," the court wrote. "This conclusion was well supported by the evidence and was not clearly erroneous."

More than two dozen people testified on the residency issue at a Chicago Board of Elections hearing in December. The three-day hearing got progressively stranger as attorneys gave way to Chicago residents who filed objections to his candidacy, including one man who asked Emanuel if he caused the 1993 siege at Waco, Texas.

The Chicago Board of Election Commissioners and a Cook County judge have previously both ruled in favor of Emanuel, a former congressman, saying he didn't abandon his Chicago residency when he went to work at the White House.

Before Thursday's ruling, a lot of pressure was put on the Illinois Supreme Court. Though some voters and politicians believe the appellate court's decision was the right one, the majority seemed to be in favor of Emanuel being able to run for mayor.

Former Republican governor James Thompson and attorneys general Tyrone Fahner and James Ryan wrote a letter to the State Journal-Register this week, calling the appellate court's decision "perverse" and urging the Supreme Court to "correct this error." NBC Chicago shared a portion of the letter Thursday:

For 144 years, Illinois law has been clear: a resident who leaves the state temporarily with an intent to return does not lose his status as a resident. However, the appellate court made a dramatic departure from this principle. It adopted a brand new standard, holding that to be a "resident" for purposes of the municipal code, one must physically live here, and that even absence as a public servant does not preserve one's residence. Under this standard, Abraham Lincoln, Barack Obama and Adlai Stevenson each ceased being "residents" when they left to serve our country. Justice Bertina Lampkin, in dissent, called this "a new and undefined standard for determining candidate residency requirements despite the plethora of clear, relevant and well-established precedent that has been used by our circuit courts and election boards for decades." We agree. We fear that the appellate court's decision has the perverse effect of punishing Mr. Emanuel for his service to our country. And we hope that the Illinois Supreme Court will correct this error and find Mr. Emanuel to be a resident for the purpose of his candidacy for mayor of Chicago.

Emanuel joined former U.S. Sen. Carol Moseley Braun, former Chicago Board of Education President Gery Chico and City Clerk Miguel del Valle in a televised debate following Thursday's ruling.

"I have banned the word 'resident' in Scrabble in our household," Emanuel said Thursday night. "I never want to see it again. Even if you get it on a triple word, you're not allowed to use it."