A report by a population policy task force chaired by the then chief secretary Donald Tsang Yam-kuen first suggested the introduction of the seven-year rule to the CSSA system.
The report was published in February 2003 just before the full severe acute respiratory syndrome (Sars) outbreak, and became policy on January 1, 2004.
It was released at a time of economic difficulty and fears of a huge government deficit during the outbreak.
It also painted a gloomy picture of the city's burden of care to its ageing population and highlighted the one-way permit scheme admitting immigrants - especially the young - from the mainland.
But the Court of Final Appeal cast doubt on the report, which was frequently cited in its 60-page judgment.
It found no support for adopting the seven-year rule and that the rule had nothing to do with the financial sustainability of the social security system.
Chief Justice Geoffrey Ma Tao-li said: "The government is undoubtedly right to regard the problems of our ageing population as serious and right to lay down policies aimed at mitigating those problems with a view to ensuring the long-term sustainability of our social welfare system.
"But what, if any, rational connection is there between such mitigation and the impugned policy of excluding new arrivals from receiving CSSA until they have resided here for seven years? I do not think any such connection exists."