The idea of the federal government being able to indefinitely commit people considered “sexually dangerous” after their federal prison terms are complete seemed attractive to some Supreme Court justices.

Lower courts have said the federal government cannot do this. But in arguments before the high court Tuesday, Solicitor General Elena Kagan said the government has the responsibility to ensure that sexual predators are not turned back onto the streets.