WASHINGTON  In a pair of unanimous decisions written by Justice Samuel A. Alito Jr., the Supreme Court on Wednesday ruled in favor of the parents of a girl who said she had been molested on a school bus and against a drug dealer whose home was searched after he invited a police informant inside.

The court also let stand without comment a lower court ruling striking down the Child Online Protection Act, putting an end to a decade of litigation. The law had made it a crime for commercial Web sites to make sexually explicit materials available to children under 17.

The case involving the student, a girl in kindergarten in Hyannis, Mass., started when she told her parents she was being sexually harassed by an 8-year-old boy every time she wore a dress or skirt to school. Her parents, dissatisfied with the school’s response to their complaints, sued under two federal laws.

The federal appeals court in Boston ruled against the parents on both claims. It said the parents could not win under Title IX, which bars sex discrimination in schools that receive federal money, because they could not prove the school system had acted unreasonably. And the parents could not invoke an older and broader civil rights law known as Section 1983, the appeals court said, because “Congress saw Title IX as the sole means of vindicating the right to be free from gender discrimination perpetrated by educational institutions.”