On Wednesday afternoon, the Supreme Court’s 2017 term came to an end along with the tenure of one of the nation’s most consequential jurists — Anthony M. Kennedy. The 2017 term saw a decisive conservative shift on the bench, in large part because Justice Kennedy, often a swing vote, joined the conservatives in all 14 of the court’s 5-4 decisions. The court decided a range of historic cases that significantly expanded as well as contracted our fundamental freedoms. Of the 72 cases heard by the justices, the American Civil Liberties Union was involved in 17, directly arguing four.

Here are five of the most significant decisions, along with the role we played, the outcomes, and what it means for Americans’ civil liberties and civil rights.

Masterpiece Cakeshop, Ltd. v. Colorado Civil Rights Commission

ACLU Role: Counsel

Result: Partial Loss, 7-2

What It Means: Equality may have lost this battle, but it won the war. The court ruled in favor of a bakery that refused to sell Dave Mullins and Charlie Craig a cake for their wedding reception because they are a same-sex couple. But it did so solely because it concluded that the state civil rights commission that adjudicated the case was infected by religious bias. It declined to hand the bakery the First Amendment right to discriminate that he — and the Trump administration — sought. And the court went out of its way to reaffirm that philosophical and religious objections do not provide a justification for a business to violate a neutral nondiscrimination law.

The bakery, backed by the Trump administration, had claimed that freedom of religion or freedom of speech should give it a blank check to violate Colorado’s Anti-Discrimination Act and turn away same-sex couples. The court didn’t accept that unprecedented theory. While it expressed concerns about the way one state’s civil rights commission handled this particular case, it reaffirmed that civil rights commissions across the country can continue to enforce our nation’s laws against discrimination, including discrimination against people who are LGBT. And that’s something to celebrate.

Carpenter v. U.S.

ACLU Role: Counsel

Result: Win, 5-4

What It Means: In a groundbreaking expansion of privacy rights in the digital age, the court held that police need a search warrant to obtain a person’s historical cell phone location data from their cellular service provider. The majority opinion, written by Chief Justice John Roberts, recognized that the comprehensive record of our locations and movements generated whenever we carry a cell phone is highly sensitive and private. His majority opinion rejected the government’s sweeping argument that a person’s Fourth Amendment privacy rights are eliminated any time their sensitive information is shared with or held by another party, such as the phone company or an internet service provider. Because we necessarily share everything we do online or on a cell phone with some third-party company, the government’s argument — which had consistently prevailed in the lower courts — would have marked the end of privacy in the digital age.

Although the case is most directly about recognizing the serious privacy implications of law enforcement access to people’s location data, it has opened space for future cases to protect many other kinds of highly private digital-age data. These include the contents of our emails and search query histories held by Google or Microsoft, the data about our health or news reading habits generated by apps on our phones, and the information about our bodies and homes created by internet-connected “smart” devices.

Jennings v. Rodriguez

ACLU Role: Counsel

Result: Loss in part, 5-3

What It Means: This case involved a challenge to the immigration service’s practice of prolonged mandatory detention without a hearing of many foreign nationals seeking asylum or other relief from deportation. The Supreme Court overturned a ruling that required the federal government to give immigrants an opportunity to ask a judge for release on bond when they had been in immigration detention for more than six months and their deportation cases remained ongoing. Two lower courts had interpreted federal immigration detention statutes to require hearings after six months of detention, while four others had interpreted the laws to require hearings after a "reasonable time."

Writing for the majority, Justice Samuel Alito found that the immigration statutes prohibited such bond hearings for immigrants. However, the immigrants had also argued that their prolonged detention without bond hearings was unconstitutional. Despite ordering supplemental briefing and a second oral argument on that issue, the court declined to decide it. Instead, it sent the case back for the Ninth Circuit Court of Appeals to address the constitutional issues. The court’s failure to address that question suggests that, with Justice Kagan recused, the Court was equally divided on the question.

The ACLU has already submitted briefing in the Ninth Circuit and other lower courts arguing that the government’s practice of locking up immigrants for more than six months without a hearing violates the Due Process Clause. Through this case and others, we will continue the fight for due process for immigrants.

Hawaii v. Trump

ACLU Role: Amicus (but counsel in IRAP v. Trump, a companion case)

Result: Loss, 5-4

What It Means: The Supreme Court allowed the third version of President Trump’s Muslim ban to stay in effect, rejecting constitutional and statutory challenges brought by the state of Hawaii. The American Civil Liberties Union and partner organizations had successfully challenged every version of the ban in a separate lawsuit, International Refugee Assistance Project v. Trump. The lower courts held that the ban violates both the Establishment Clause and U.S. immigration law prohibiting national-origin discrimination.

President Trump had repeatedly vowed to ban Muslims, openly admitting his anti-Islam animus. The Establishment Clause absolutely forbids government action targeting a particular religion. Nonetheless, applying extraordinary deference to the president, the court applied only “rational basis” scrutiny and upheld the order because it was “plausibly” related to national security. Despite overwhelming evidence that the ban was targeted at Muslims, the court found that it had “a legitimate grounding in national security concerns, quite apart from any religious hostility.”

As Justice Sotomayor wrote in her dissenting opinion, the majority could reach this conclusion only by “ignoring the facts, misconstruing our legal precedent, and turning a blind eye to the pain and suffering the Proclamation inflicts upon countless families and individuals.”

Husted v. A. Phillip Randolph Institute

ACLU Role: Counsel

Result: Loss, 5-4

What It Means: In a setback for voting rights, the court upheld an Ohio voter purge program that targets registered voters who do not vote in a two-year period for removal from the rolls and removes them if they fail to respond to a mailed notice and fail to vote in the next two elections. The program erroneously purged thousands of voters, and as Justice Sonia Sotomayor noted in a pointed dissent, “disproportionately affected minority, low-income, disabled and veteran voters.” The court’s decision effectively sanctions similar programs already on the books in six other states and may encourage others to join that group.

The court, however, did not green light wholesale purges of registered voters without first them providing notice and an opportunity to contest their removal. Although the court permitted Ohio’s purge program, it did so because the targeted voters are removed only after they receive a notice and subsequently do not vote or respond to the notice for another four years. As the majority opinion, written by Justice Samuel Alito, acknowledged, “the NVRA is clear about the need to send a ‘return card’ (or obtain written confirmation of a move)” before a state may remove a registered voter.