There were two main issues at stake in this case. First, there was the issue of whether detainees at the Guantanamo Bay naval base had the right to petition for a writ of habeas corpus. Second, there was the issue of whether the law that Congress had passed to govern the Guantanamo detainees actually took that right away from them.
The Court held first of all that the detainees had the right to petition for habeas corpus. The Court held that, even though Guantanamo is in Cuba and is therefore not US soil, the detainees still have rights under the Constitution. This is because, the Court held, the US has de facto control over Guantanamo even if it does not have ultimate legal authority over the territory.
Once the Court established that the detainees had the right to petition for habeas corpus, it had to determine whether the Military Commissions Act of 2006 had taken that right away. The Court ruled that the MCA had indeed stripped the detainees of any effective way to petition for habeas corpus. Thus, the ruling of the Court was that the MCA was unconstitutional because it took the right to habeas corpus away from people who were entitled to that right.