U.S. Supreme Court Chief Justice John G. Roberts, Jr. waits for the arrival of former U.S. President George H.W. Bush at the U.S Capitol Rotunda on December 03, 2018 in Washington, DC. (Jabin Botsford - Pool/Getty Images)
PHOTO: Pool/Getty Images
U.S. Supreme Court Chief Justice John G. Roberts, Jr. waits for the arrival of former U.S. President George H.W. Bush at the U.S Capitol Rotunda on December 03, 2018 in Washington, DC. (Jabin Botsford - Pool/Getty Images)
Now playing
01:42
Why Roberts voted against Trump's citizenship question (2019)
PHOTO: Gov. Cuomo's office
Now playing
03:35
Gov. Andrew Cuomo addresses women's allegations
Cuomo
PHOTO: Gov. Cuomo's Office
Cuomo
Now playing
00:56
Cuomo says he has no plans to resign
Now playing
04:51
Elected Republican who supports Biden's bill speaks out
President Joe Biden speaks during a meeting about cancer in the Oval Office of the White House, Wednesday, March 3, 2021, in Washington. (AP Photo/Alex Brandon)
PHOTO: Alex Brandon/AP
President Joe Biden speaks during a meeting about cancer in the Oval Office of the White House, Wednesday, March 3, 2021, in Washington. (AP Photo/Alex Brandon)
Now playing
01:20
'Neanderthal thinking': Biden on states lifting mask restrictions
PHOTO: CNN/Getty
Now playing
02:10
'Highly misleading at best': Dale reacts to Pence's op-ed
Commanding General District of Columbia National Guard Major General William J. Walker testifies before the Senate Homeland Security and Governmental Affairs/Rules and Administration hearing to examine the January 6, 2021 attack on the US Capitol on Capitol Hill on March 3, 2021 in Washington, DC. (Photo by Greg Nash / POOL / AFP) (Photo by GREG NASH/POOL/AFP via Getty Images)
PHOTO: GREG NASH/POOL/AFP via Getty Images
Commanding General District of Columbia National Guard Major General William J. Walker testifies before the Senate Homeland Security and Governmental Affairs/Rules and Administration hearing to examine the January 6, 2021 attack on the US Capitol on Capitol Hill on March 3, 2021 in Washington, DC. (Photo by Greg Nash / POOL / AFP) (Photo by GREG NASH/POOL/AFP via Getty Images)
Now playing
03:01
DC National Guard commander: 'Unusual' Pentagon restrictions slowed response to Capitol riot
FBI Director Christopher Wray testifies before the Senate Judiciary Committee on the January 6th insurrection, in the Hart Senate Office Building on Capitol Hill in Washington, DC on March 2, 2021. (Photo by MANDEL NGAN / POOL / AFP) (Photo by MANDEL NGAN/POOL/AFP via Getty Images)
PHOTO: MANDEL NGAN/POOL/AFP via Getty Images
FBI Director Christopher Wray testifies before the Senate Judiciary Committee on the January 6th insurrection, in the Hart Senate Office Building on Capitol Hill in Washington, DC on March 2, 2021. (Photo by MANDEL NGAN / POOL / AFP) (Photo by MANDEL NGAN/POOL/AFP via Getty Images)
Now playing
02:55
Watch FBI director debunk conspiracy theories pushed by Trump supporters
abrams
PHOTO: CNN
abrams
Now playing
00:51
Abrams on voting rights: We're fighting to protect our democracy from domestic enemies
Goya Foods President Robert Unanue speaks at a press conference with Carlos Vecchio, the Venezuelan Ambassador who is recognized by the United States on December 21, 2020 in Doral, Florida. The two held the press conference to discuss details of a recent shipment of humanitarian aid to Venezuela, donated by Goya Foods. (Photo by Joe Raedle/Getty Images)
PHOTO: Joe Raedle/Getty Images
Goya Foods President Robert Unanue speaks at a press conference with Carlos Vecchio, the Venezuelan Ambassador who is recognized by the United States on December 21, 2020 in Doral, Florida. The two held the press conference to discuss details of a recent shipment of humanitarian aid to Venezuela, donated by Goya Foods. (Photo by Joe Raedle/Getty Images)
Now playing
03:24
Goya CEO under fire for false Trump election claims
Rep. Adam Kinzinger (R-IL) speaks to CNN's Alisyn Camerota about why he thinks that the Republican Party will move on from former President Donald Trump.
PHOTO: CNN
Rep. Adam Kinzinger (R-IL) speaks to CNN's Alisyn Camerota about why he thinks that the Republican Party will move on from former President Donald Trump.
Now playing
02:03
Kinzinger: Trump is a loser and we will move on
Now playing
04:17
NYC mayor says Gov. Cuomo should resign if allegations are true
NEW YORK, NY - JULY 23: New York Gov. Andrew Cuomo speaks during the daily media briefing at the Office of the Governor of the State of New York on July 23, 2020 in New York City. The Governor said the state liquor authority has suspended 27 bar and restaurant alcohol licenses for violations of social distancing rules as public officials try to keep the coronavirus outbreak under control. (Photo by Jeenah Moon/Getty Images)
PHOTO: Jeenah Moon/Getty Images
NEW YORK, NY - JULY 23: New York Gov. Andrew Cuomo speaks during the daily media briefing at the Office of the Governor of the State of New York on July 23, 2020 in New York City. The Governor said the state liquor authority has suspended 27 bar and restaurant alcohol licenses for violations of social distancing rules as public officials try to keep the coronavirus outbreak under control. (Photo by Jeenah Moon/Getty Images)
Now playing
02:29
NYT: Third woman comes forward against Gov. Andrew Cuomo
WASHINGTON, DC - MAY 25: U.S. President Donald Trump and first lady Melania Trump depart the White House for Baltimore, Maryland on May 25, 2020 in Washington, DC. The Trumps will attend a Memorial Day ceremony at the Fort McHenry National Monument and Historic Shrine despite objections by Baltimore Mayor Bernard C. "Jack" Young, whose residents remain under a stay-at-home order due to the coronavirus. (Photo by Sarah Silbiger/Getty Images)
PHOTO: Sarah Silbiger/Getty Images North America/Getty Images
WASHINGTON, DC - MAY 25: U.S. President Donald Trump and first lady Melania Trump depart the White House for Baltimore, Maryland on May 25, 2020 in Washington, DC. The Trumps will attend a Memorial Day ceremony at the Fort McHenry National Monument and Historic Shrine despite objections by Baltimore Mayor Bernard C. "Jack" Young, whose residents remain under a stay-at-home order due to the coronavirus. (Photo by Sarah Silbiger/Getty Images)
Now playing
02:10
Trump got vaccinated in secret. Here's why this matters
Kinzinger
PHOTO: CNN
Kinzinger
Now playing
03:55
Republican lawmaker reacts to being on Trump's 'enemies list'
Former Ambassador to the United Nations Nikki Haley speaks during the first day of the Republican convention at the Mellon auditorium on August 24, 2020 in Washington, DC (Photo by Olivier DOULIERY / AFP) (Photo by OLIVIER DOULIERY/AFP via Getty Images)
PHOTO: Olivier Douliery/AFP/Getty Images
Former Ambassador to the United Nations Nikki Haley speaks during the first day of the Republican convention at the Mellon auditorium on August 24, 2020 in Washington, DC (Photo by Olivier DOULIERY / AFP) (Photo by OLIVIER DOULIERY/AFP via Getty Images)
Now playing
04:41
Haley flip flops on Trump, praising his 'strong speech'
(CNN) —  

Chief Justice John Roberts cast the deciding vote against President Donald Trump’s attempt to add a citizenship question to the 2020 census, but only after changing his position behind the scenes, sources familiar with the private Supreme Court deliberations tell CNN.

The case was fraught with political consequences. Democrats and civil rights advocates claimed the query would discourage responses to the decennial questionnaire from new immigrants and minorities and affect the balance of power nationwide.

Roberts’ action recalled his dramatic switch in the 2012 case that saved President Barack Obama’s Affordable Care Act. Once again, the chief, an appointee of President George W. Bush and a reliable conservative, had sided with the liberals as a dispute of immense national significance went down to the wire.

More broadly, his moves in the census dispute demonstrate that as he begins his 15th year as chief justice, Roberts has become less predictable. He is wearing the heavy mantle of a vote at the middle of a divided bench in this new chapter of his tenure, with the 2018 retirement of centrist-conservative Justice Anthony Kennedy and a solid 5-4 conservative majority.

For the most part, Roberts’ opinion in the census case laid out why Commerce Secretary Wilbur Ross had significant latitude to add a new question. He was joined by his four conservative brethren on that point. But then the chief justice swerved, and joined by the four liberal justices, said Ross’ justification for the citizenship question, tied to enforcing the Voting Rights Act, was contrived.

After the justices heard arguments in late April, Roberts was ready to rule for Ross and the administration. But sometime in the weeks that followed, sources said, Roberts began to waver. He began to believe that Ross’ rationale for the citizenship question had been invented, and that, despite the deference he would normally give an executive branch official, Ross’ claim had to matter in the court’s final judgment, which Roberts announced on June 27.

Roberts’ action in the case adds a new dimension to the question that has hung over Trump’s presidency and is especially at the forefront as the justices begin a new annual session in October: Will America’s highest court restrain the administration’s most controversial policies?

On the whole, the 64-year-old Roberts has given the Trump administration great leeway. A year ago, he accepted its arguments and wrote the court’s opinion upholding Trump’s travel ban. And earlier this year, Roberts voted to allow the administration to ban transgender people from serving in the military and allow Trump to use military funds to build a border wall. On Wednesday night, he let drastic limits on Central Americans seeking asylum at the southern border take effect.

Yet on the census, Roberts turned against the administration.

Unlike the other branches of government, the Supreme Court is highly secretive and justices and their staff rarely disclose what they talk about behind closed doors. These developments are reported here for the first time, but much is still unknown about the private deliberations. Roberts declined to comment on this report.

Passions on the citizenship question

In proposing to add the citizenship question to the full census, Ross insisted that it was needed because the Justice Department needed citizenship data to enforce the 1965 Voting Rights Act.

Multiple cities, states and civil rights groups sued, saying that the question would decrease the response rate of new immigrants and, because the count is used to apportion seats for the US House of Representatives and statehouses, undercut political representation for mainly urban, heavily immigrant locales in America. The figures also determine how funding for a multitude of federal programs is distributed nationwide.

After a trial in New York, US District Court Judge Jesse Furman ruled that Ross, among other transgressions, had violated the Administrative Procedure Act’s prohibition on “arbitrary and capricious” agency choices.

Furman said the evidence showed that soon after Ross took office in early 2017, he discussed the addition of the citizenship question with then-White House adviser Steve Bannon. Furman found that Ross had sought to add the citizenship question independent of the DOJ request, which he had solicited to back up his plan.

“[P]erhaps most egregiously,” Furman said in an opinion that ran 277 pages, “the evidence is clear that Secretary Ross’s rationale was pretextual — that is, that the real reason for his decision was something other than the sole reason he put forward in his Memorandum, namely enhancement of DOJ’s VRA enforcement efforts.”

The Trump administration appealed Furman’s decision directly to the Supreme Court, saying the matter was urgent because census forms would have to be printed by summer.

During oral arguments on April 23, Roberts suggested there were grounds for adding the citizenship question that had not been asked of all households since 1950.

“We’ve had demographic questions on the census – I don’t know how far back, but, certainly, it’s quite common. … Sex, age, things like that. … Do you own your house? Do you own a radio? I mean, the questions go quite beyond how many people there are,” Roberts said.

“The CVAP, Citizen Voting Age Population, is the critical element in voting rights enforcement, and this is getting citizen information,” he added.

RELATED: Read: Oral arguments in Supreme Court census citizenship case

The chief justice did not question whether Ross had concocted his justification for the citizenship question, as Furman had found. The challengers’ lawyers avoided the topic as well, instead stressing that Commerce Department had violated standards and safeguards for policy changes under the Administrative Procedure Act.

The only person to use the word “contrived” and emphasize the possible pretextual grounds was Justice Elena Kagan. “You can’t read this record without sensing that this need is a contrived one,” she told US Solicitor General Noel Francisco, representing Ross and the Commerce Department.

Based on the tenor of the arguments, journalists and legal commentators presumed that the court was headed for a 5-4, conservative-liberal, vote. Inside the court after initial deliberations, that was how the justices divided.

But the decision-writing process is fluid. As they draft and share opinions, justices sometimes change positions, subtly in ways that affect parts of the legal reasoning undergirding an opinion, or more dramatically in ways that affect the entire outcome.

Sources familiar with deliberations say that two such noteworthy changes occurred last session, in the census controversy and in a dispute over the validity of a federal sex offender registration act.

In that latter case, the justices upheld the act by a 5-3 vote. (Justice Brett Kavanaugh did not participate in that case heard on the second day of the new session because he was not yet confirmed for the bench.)

Earlier in those negotiations that began in October and stretched until June, a different five-justice majority was headed in the opposite direction, toward invalidating the law and potentially limiting the authority of Congress to delegate power to another branch of government. (The 2006 Sex Offender Registration and Notification Act gave the attorney general authority to determine how the law applies to some convicts; Roberts, who dissented from the final decision preserving Congress’ delegation power, did not switch his vote in this case, Gundy v. United States.)

RELATED: Supreme Court upholds the scope of federal sex offender registration law in case testing ‘nondelegation doctrine’

The momentous announcement

On the last day of the annual term, Roberts showed his hand, but not without some suspense.

The first 24 pages of his 29-page census ruling rejected the challengers’ arguments based on the Constitution’s Enumeration Clause and the requirements of the Administrative Procedure Act. Roberts said judges should broadly defer to the administration as it devises the census form.

Provided the justification is truthful, that is.

To accept Ross’ explanation grounded in the Voting Rights Act, the chief justice suggested in the final pages of his opinion, would essentially allow administration officials to dupe judges. Roberts said there was “a significant mismatch between the decision the Secretary made and the rationale he provided.”

Declared Roberts, quoting the late US Appeals Court Judge Henry Friendly, for whom he once worked, “Our review is deferential, but we are ‘not required to exhibit a naivete from which ordinary citizens are free.’”

The four other conservative justices, dissenting on this part of the ruling, believed Furman had wrongly probed Ross’ rationale. Justice Clarence Thomas, joined by Justices Neil Gorsuch and Kavanaugh in an opinion, expressed suspicions of Furman’s own motives as he had detailed evidence of pretext against Ross.

“I do not deny that a judge predisposed to distrust the Secretary or the administration could arrange those facts on a corkboard and – with a jar of pins and a spool of string – create an eye-catching conspiracy web.” (Justice Samuel Alito separately dissented.)

Trump’s immediate reaction was disbelief.

“Can anyone really believe that as a great Country, we are not able the ask whether or not someone is a Citizen,” Trump tweeted on June 27. “Only in America!”

Roberts’ decision, in theory, allowed Ross to try a new justification that would support asking people their citizenship status, and for two weeks after the ruling the administration considered ways to follow through on the 2020 plan.

But deadlines for printing the forms were at hand, and the motives of administration officials remained suspect. Trump announced on July 11 that he was dropping the plan to modify the 2020 long form and would seek citizenship information through other federal data collections.

Politics and new evidence

Roberts has strived to protect the reputation of the judiciary and to counteract what might be seen as predictable moves by him and the four other Republican-appointed justices who hold the majority. The four liberal justices are all Democratic appointees.

On the morning of June 27, both sides got a win.

Minutes before announcing that he voted against Republican interests in the census case, Roberts issued a separate, arguably more enduring, decision closing federal court doors to lawsuits against extreme partisan gerrymanders. Republicans currently dominate the country’s statehouses, where district maps are drawn and have increasingly entrenched incumbents, and Democrats have increasingly tried to challenge those in court.

Roberts was joined in that case, centering on challenges to districts in North Carolina and Maryland, by his fellow justices on the right, as the four justices on the left passionately dissented. The political nature of the case and that divide between justices generated exactly the kind of criticism – that justices are merely politicians in black robes – that Roberts spent much of the 2018-2019 session trying to thwart.

RELATED: Supreme Court allows severe partisan gerrymandering to continue

“We do not serve one party or one interest,” Roberts had said at the start of the last term he tried to defuse some of the tensions from Kavanaugh’s confirmation hearings. “We serve one nation.”

03:35 - Source: CNN
Gov. Andrew Cuomo addresses women's allegations
PHOTO: Gov. Cuomo's office
Now playing
03:35
Gov. Andrew Cuomo addresses women's allegations
Cuomo
PHOTO: Gov. Cuomo's Office
Cuomo
Now playing
00:56
Cuomo says he has no plans to resign
Now playing
04:51
Elected Republican who supports Biden's bill speaks out
President Joe Biden speaks during a meeting about cancer in the Oval Office of the White House, Wednesday, March 3, 2021, in Washington. (AP Photo/Alex Brandon)
PHOTO: Alex Brandon/AP
President Joe Biden speaks during a meeting about cancer in the Oval Office of the White House, Wednesday, March 3, 2021, in Washington. (AP Photo/Alex Brandon)
Now playing
01:20
'Neanderthal thinking': Biden on states lifting mask restrictions
PHOTO: CNN/Getty
Now playing
02:10
'Highly misleading at best': Dale reacts to Pence's op-ed
Commanding General District of Columbia National Guard Major General William J. Walker testifies before the Senate Homeland Security and Governmental Affairs/Rules and Administration hearing to examine the January 6, 2021 attack on the US Capitol on Capitol Hill on March 3, 2021 in Washington, DC. (Photo by Greg Nash / POOL / AFP) (Photo by GREG NASH/POOL/AFP via Getty Images)
PHOTO: GREG NASH/POOL/AFP via Getty Images
Commanding General District of Columbia National Guard Major General William J. Walker testifies before the Senate Homeland Security and Governmental Affairs/Rules and Administration hearing to examine the January 6, 2021 attack on the US Capitol on Capitol Hill on March 3, 2021 in Washington, DC. (Photo by Greg Nash / POOL / AFP) (Photo by GREG NASH/POOL/AFP via Getty Images)
Now playing
03:01
DC National Guard commander: 'Unusual' Pentagon restrictions slowed response to Capitol riot
FBI Director Christopher Wray testifies before the Senate Judiciary Committee on the January 6th insurrection, in the Hart Senate Office Building on Capitol Hill in Washington, DC on March 2, 2021. (Photo by MANDEL NGAN / POOL / AFP) (Photo by MANDEL NGAN/POOL/AFP via Getty Images)
PHOTO: MANDEL NGAN/POOL/AFP via Getty Images
FBI Director Christopher Wray testifies before the Senate Judiciary Committee on the January 6th insurrection, in the Hart Senate Office Building on Capitol Hill in Washington, DC on March 2, 2021. (Photo by MANDEL NGAN / POOL / AFP) (Photo by MANDEL NGAN/POOL/AFP via Getty Images)
Now playing
02:55
Watch FBI director debunk conspiracy theories pushed by Trump supporters
abrams
PHOTO: CNN
abrams
Now playing
00:51
Abrams on voting rights: We're fighting to protect our democracy from domestic enemies
Goya Foods President Robert Unanue speaks at a press conference with Carlos Vecchio, the Venezuelan Ambassador who is recognized by the United States on December 21, 2020 in Doral, Florida. The two held the press conference to discuss details of a recent shipment of humanitarian aid to Venezuela, donated by Goya Foods. (Photo by Joe Raedle/Getty Images)
PHOTO: Joe Raedle/Getty Images
Goya Foods President Robert Unanue speaks at a press conference with Carlos Vecchio, the Venezuelan Ambassador who is recognized by the United States on December 21, 2020 in Doral, Florida. The two held the press conference to discuss details of a recent shipment of humanitarian aid to Venezuela, donated by Goya Foods. (Photo by Joe Raedle/Getty Images)
Now playing
03:24
Goya CEO under fire for false Trump election claims
Rep. Adam Kinzinger (R-IL) speaks to CNN's Alisyn Camerota about why he thinks that the Republican Party will move on from former President Donald Trump.
PHOTO: CNN
Rep. Adam Kinzinger (R-IL) speaks to CNN's Alisyn Camerota about why he thinks that the Republican Party will move on from former President Donald Trump.
Now playing
02:03
Kinzinger: Trump is a loser and we will move on