He challenged the law both as a violation of the Equal Protection Clause and the Second Amendment.
On the EP challenge, the Court correctly observed that discrimination based on alienage need only meet rational basis review, the easiest test under the Equal Protection Clause, because alienage is not a protected class when a federal law is being challenged. (It is a protected class with respect to state laws.)
As to the Second Amendment, the Court held that it wasn’t clear whether non-citizens are entitled to gun rights, but if they are, restrictions on certain non-citizens are probably subject to intermediate scrutiny. No one really know what the test should be, but from Heller it seems like intermediate scrutiny is probably correct since it would be hard to justify the restrictions on felons, etc., under strict scrutiny, but fundamental rights generally get stronger protection than rational basis review.
From there the Court observed that “The bottom line is that crime control and public safety are indisputably ‘important’ interests,” and that “Congress may have concluded that illegal aliens, already in probable present violation of the law, simply do not receive the full panoply of constitutional rights enjoyed by law-abiding citizens. Or that such individuals, largely outside the formal system of registration, employment, and identification, are harder to trace and more likely to assume a false identity. Or Congress may have concluded that those who show a willingness to defy our law are candidates for further misfeasance or at least a group that ought not be armed when authorities seek them. It is surely a generalization to suggest, as courts do . . . that unlawfully present aliens, as a group, pose a greater threat to public safety—but general laws deal in generalities.”
Seems basically correct to me, if you accept (as the Court must), the premises set out by the Supreme Court. But it is worth noting that this Court, like most, treats Second Amendment rights as second-class rights, not deserving of the same status as the First Amendment, say, with respect to the level of scrutiny.