Today the ECJ ruled that EU Social Security Regulations also apply to non-EU nationals staying in the EU
Regulation (EC) No 883/2004 and Regulation (EC) No 987/2009 shall also apply to nationals of non-EU countries who are not already covered by those Regulations solely on the ground of their nationality, provided that they are legally staying in the territory of a Member State and are in a situation [...]