(CNN) In an unexpected victory for union supporters, the Supreme Court said Tuesday it was evenly divided in a case concerning public sector unions, and therefore it affirmed the lower court decision in organized labor's favor.

The result leaves intact a nearly 40-year-old precedent and is most likely reflective of the impact that Justice Antonin Scalia's death had on pending cases.

At oral arguments, the high court seemed poised to deal a major blow to unions and overrule precedent, but with Scalia's death there were no longer five justices available to do so.

The challenge was brought by a group of public school teachers in California -- backed by the libertarian Center for Individual Rights, which, as non-members of the union, is required by California law to contribute to fees germane to collective bargaining.

The center argued that the fees violated its First Amendment right against compelled speech and urged the court to overturn precedent that held that while the unions could not mandate fees from non-members for ideological or political advocacy, it could charge for collective bargaining that goes to issues, such as wages and grievances.

Photos: Remembering Justice Antonin Scalia Photos: Remembering Justice Antonin Scalia U.S. Supreme Court Police pallbearers carry Associate Justice Antonin Scalia's flag-covered casket between rows of Catholic clergy and out of the Basilica of the National Shrine of the Immaculate Conception after his funeral on Saturday, February 20, in Washington. Hide Caption 1 of 26 Photos: Remembering Justice Antonin Scalia Supreme Court Justice Sonia Sotomayor, center, and former Justice David Souter, right, walk down the steps of the Basilica of the National Shrine of the Immaculate Conception at the end of the funeral. Hide Caption 2 of 26 Photos: Remembering Justice Antonin Scalia Former U.S. Supreme Court Associate Justice John Paul Stevens departs from the funeral for Scalia. Hide Caption 3 of 26 Photos: Remembering Justice Antonin Scalia The Rev. Paul Scalia, son of Supreme Court Justice Antonin Scalia, leads the funeral Mass for his father on February 20. Hide Caption 4 of 26 Photos: Remembering Justice Antonin Scalia Justice Clarence Thomas delivers a reading during the funeral Mass fo February 20. Hide Caption 5 of 26 Photos: Remembering Justice Antonin Scalia Scalia's casket is taken into the Basilica of the National Shrine of the Immaculate Conception on February 20 in Washington. Hide Caption 6 of 26 Photos: Remembering Justice Antonin Scalia Maureen Scalia, right, arrives for the funeral for her husband on February 20. Hide Caption 7 of 26 Photos: Remembering Justice Antonin Scalia Justice Ruth Bader Ginsburg arrives for Scalia's funeral on February 20. Hide Caption 8 of 26 Photos: Remembering Justice Antonin Scalia Justice Anthony Kennedy and his wife, Mary Davis, arrive at Scalia's funeral Mass on February 20. Hide Caption 9 of 26 Photos: Remembering Justice Antonin Scalia Justice Stephen Breyer and his wife, Joanna Hare, arrive on February 20. Hide Caption 10 of 26 Photos: Remembering Justice Antonin Scalia Chief Justice John Roberts, his wife, Jane Roberts, and daughter Josie Roberts arrive for the funeral on February 20. Hide Caption 11 of 26 Photos: Remembering Justice Antonin Scalia The casket containing Scalia's body arrives at the Basilica of the National Shrine of the Immaculate Conception. Hide Caption 12 of 26 Photos: Remembering Justice Antonin Scalia The hearse carrying Scalia's casket arrives at the Basilica of the National Shrine of the Immaculate Conception in Washington on February 20. Hide Caption 13 of 26 Photos: Remembering Justice Antonin Scalia Former Vice President Dick Cheney, left, and Supreme Court Justice Clarence Thomas take their seats for the funeral Mass on February 20. Hide Caption 14 of 26 Photos: Remembering Justice Antonin Scalia Republican presidential candidate Sen. Ted Cruz arrives for the funeral Mass on February 20. Hide Caption 15 of 26 Photos: Remembering Justice Antonin Scalia A hearse carrying the casket departs the U.S. Supreme Court Building on February 20. Hide Caption 16 of 26 Photos: Remembering Justice Antonin Scalia U.S. President Barack Obama and first lady Michelle Obama pay their respects as the body of Supreme Court Justice Antonin Scalia lies in repose on Friday, February 19. Hide Caption 17 of 26 Photos: Remembering Justice Antonin Scalia U.S. Supreme Court justices attend a private ceremony in the court's Great Hall on February 19. Facing the camera, from right, are justices Sonia Sotomayor, Stephen Breyer, Clarence Thomas, John Roberts, Anthony Kennedy, Ruth Bader Ginsburg, Samuel Alito and Elena Kagan. Hide Caption 18 of 26 Photos: Remembering Justice Antonin Scalia People look at a portrait of Scalia while paying their respects in Washington on February 19. Hide Caption 19 of 26 Photos: Remembering Justice Antonin Scalia Scalia's son Paul, a Catholic priest, leads a prayer for his father during the private ceremony at the Supreme Court. Hide Caption 20 of 26 Photos: Remembering Justice Antonin Scalia Family members watch as Scalia's casket is carried up the steps of the Supreme Court building on February 19. Hide Caption 21 of 26 Photos: Remembering Justice Antonin Scalia Law clerks line the steps of the Supreme Court building on February 19. "As is the tradition, Justice Scalia's law clerks will stand vigil by his side at the Court all day tomorrow and through the night," tweeted Kannon Shanmugam, who clerked for Scalia. Hide Caption 22 of 26 Photos: Remembering Justice Antonin Scalia Pallbearers carry Scalia's casket on February 19. Hide Caption 23 of 26 Photos: Remembering Justice Antonin Scalia People wait in line outside the Supreme Court on February 19. Hide Caption 24 of 26 Photos: Remembering Justice Antonin Scalia People watch as Scalia's casket is carried toward the Supreme Court building. Hide Caption 25 of 26 Photos: Remembering Justice Antonin Scalia The pallbearers unload Scalia's casket from a hearse. Hide Caption 26 of 26

Supporters of public sector unions feared that the court would wipe out that precedent and weaken the coffers at a time when union membership has been declining in general.

The ruling could have affected thousands of contracts and millions of employees.

At arguments, it seemed the conservative legal challenge might win five votes from the conservatives, but after Scalia's death, the court was deadlocked 4-4.

"For several years, it had seemed increasingly clear that the court's conservative majority would overrule the 1977 decision that had upheld these 'agency-shop' arrangements," said Stephen I. Vladeck, a professor of law at American University Washington College of Law and a CNN contributor.

"But with Justice Scalia's death, the conservatives lost their majority -- and, thus, their ability to change precedent. Today's result isn't a big surprise, but it is yet further indication of the problems posed by an eight-justice court," he said.

JUST WATCHED Who is Merrick Garland? Replay More Videos ... MUST WATCH Who is Merrick Garland? 01:00

President Barack Obama has nominated Merrick Garland to fill Scalia's seat, though Republicans have said they want the next president to nominate the replacement. Garland is scheduled to have his first meeting with a Republican senator Tuesday when he sits down with Mark Kirk of Illinois, a centrist running for re-election in a Democratic-leaning state.

Twenty-five states currently forbid mandatory union fees, and lawyers for the teachers hoped the Supreme Court would extend that nationwide and deal a victory to teachers like lead plaintiff Rebecca Friedrichs.

Michael A. Carvin, a lawyer for Friedrichs, argued in court papers that California law "requires thousands of public-school teachers to pay hundreds of millions of dollars" to the teachers union. He said that the distinction between permissible fees that are supposed to go toward collective bargaining and impermissible fees that go to political ideology is "unworkable" in the public sector. For instance, Carvin said state law authorizes teachers unions to bargain over class size and teaching tenure, two hotly debated policy issues that are currently playing out in the political debate.

His clients don't want to have to pay fees for union positions that they don't support. "Bedrock First Amendment principles forbid the compelled support of ideological advocacy," Carvin said.

Photos: Today's Supreme Court Photos: Today's Supreme Court The justices of the US Supreme Court sit for an official photograph on June 1, 2017. In the front row, from left, are Ruth Bader Ginsburg, Anthony Kennedy, Chief Justice John Roberts, Clarence Thomas and Stephen Breyer. In the back row, from left, are Elena Kagan, Samuel Alito, Sonia Sotomayor and Neil Gorsuch. Hide Caption 1 of 10 Photos: Today's Supreme Court In 2005, John Roberts was nominated by President George W. Bush to succeed Sandra Day O'Connor as an associate justice on the US Supreme Court. After Chief Justice William Rehnquist died, Bush named Roberts to the chief justice post. The court has moved to the right during Roberts' tenure, although Roberts supplied the key vote to uphold Barack Obama's Affordable Care Act. Hide Caption 2 of 10 Photos: Today's Supreme Court Anthony Kennedy was appointed to the court by President Ronald Reagan in 1988. He is a conservative justice but has provided crucial swing votes in many cases. He has authored landmark opinions that include Obergefell v. Hodges, which legalized same-sex marriage nationwide. Hide Caption 3 of 10 Photos: Today's Supreme Court Clarence Thomas is the second African-American to serve on the court, succeeding Thurgood Marshall when he was appointed by President George H. W. Bush in 1991. Thomas is a conservative and a strict constructionist who supports states' rights. Hide Caption 4 of 10 Photos: Today's Supreme Court Ruth Bader Ginsburg is the second woman to serve on the Supreme Court. Appointed by President Bill Clinton in 1993, she is a strong voice in the court's liberal wing. Hide Caption 5 of 10 Photos: Today's Supreme Court Stephen Breyer was appointed by Clinton in 1994 and is part of the court's liberal wing. Hide Caption 6 of 10 Photos: Today's Supreme Court Samuel Alito was appointed by President George W. Bush in 2006 and is known as one of the most conservative justices to serve on the court in modern times. Hide Caption 7 of 10 Photos: Today's Supreme Court Sonia Sotomayor is the court's first Hispanic and third female justice. She was appointed by Obama in 2009 and is regarded as a resolutely liberal member of the court. Hide Caption 8 of 10 Photos: Today's Supreme Court Elena Kagan is the fourth female justice to ever be appointed, and she is counted among the court's liberal wing. She was appointed by Obama in 2010 at the age of 50. She is the court's youngest member. Hide Caption 9 of 10 Photos: Today's Supreme Court Neil Gorsuch is the court's newest member. He was chosen by President Donald Trump to replace Antonin Scalia, who died in 2016. Hide Caption 10 of 10

Lawyers for the California Teachers Association defended the state system and argued that the agency fees serve the interest of the state to engage in "orderly negotiation of terms and conditions of employment and resolution of employee grievances," while at the same time ensuring the "fair allocation" of the costs that service all employees. They said the vast majority of issues on which the unions bargain are of interest to all union and non-union employees alike.

"Outlawing fair-share fees will override the judgments of 23 States plus the District of Columbia that have enacted statutory collective-bargaining frameworks covering public-education employees," David C. Frederick, a lawyer for the union, argued in court papers. "It will also throw into disarray tens of thousands of collective bargaining agreements governing millions of teachers, police officers, firefighters, first responders and other public employees," he said.

The Obama administration supported the unions in the case.

"Petitioners' attempt to demolish this Court's settled framework for analyzing conditions of public employment would astonish the Founding generation and would stamp out the State-by-State variation in public-employment structures that has been the hallmark of this Court's First Amendment jurisprudence for decades," Solicitor General Donald B. Verrilli wrote.