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)
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)
U.S. President Joe Biden speaks from the Treaty Room in the White House about the withdrawal of U.S. troops from Afghanistan on April 14, 2021 in Washington, DC. President Biden announced his plans to pull all remaining U.S. troops out of Afghanistan by September 11, 2021 in a final step towards ending America's longest war.
Andrew Harnik/Pool/Getty Images
U.S. President Joe Biden speaks from the Treaty Room in the White House about the withdrawal of U.S. troops from Afghanistan on April 14, 2021 in Washington, DC. President Biden announced his plans to pull all remaining U.S. troops out of Afghanistan by September 11, 2021 in a final step towards ending America's longest war.
Now playing
01:03
Biden: It's time to end the forever war
Kinzinger
CNN
Kinzinger
Now playing
05:56
What Republican lawmaker fears after US troops leave Afghanistan
CNN
Now playing
02:45
Sen. Bernie Sanders: Trump was right about this
Rep. Matt Gaetz, R-Fla., questions witnesses during a House Armed Services Committee hearing on Capitol Hill, Wednesday, April 14, 2021, in Washington.
Manuel Balce Ceneta/AP
Rep. Matt Gaetz, R-Fla., questions witnesses during a House Armed Services Committee hearing on Capitol Hill, Wednesday, April 14, 2021, in Washington.
Now playing
02:59
Women detail late-night parties with Gaetz
One shot doses of the Johnson & Johnson COVID-19 vaccine are prepared at a clinic targeting immigrant community members on March 25, 2021 in Los Angeles, California.  The clinic, run by the St. John's Well Child and Family Center, estimates it has vaccinated more than 100,000 people in the Los Angeles area amid reports of two undocumented women who were refused coronavirus vaccinations in Orange County Rite Aid stores. Rite Aid has called the refusals mistakes in a written statement.  (Photo by Mario Tama/Getty Images)
Mario Tama/Getty Images
One shot doses of the Johnson & Johnson COVID-19 vaccine are prepared at a clinic targeting immigrant community members on March 25, 2021 in Los Angeles, California. The clinic, run by the St. John's Well Child and Family Center, estimates it has vaccinated more than 100,000 people in the Los Angeles area amid reports of two undocumented women who were refused coronavirus vaccinations in Orange County Rite Aid stores. Rite Aid has called the refusals mistakes in a written statement. (Photo by Mario Tama/Getty Images)
Now playing
02:48
These unlikely events are still more likely than a blood clot after the J&J vaccine
U.S. Marines conduct an operation to clear a village of Taliban fighters in July 2009 in Mian Poshteh, Afghanistan.
Joe Raedle/Getty Images
U.S. Marines conduct an operation to clear a village of Taliban fighters in July 2009 in Mian Poshteh, Afghanistan.
Now playing
03:19
Biden to announce Afghanistan withdrawal by September 11
roger wicker
CNN
roger wicker
Now playing
04:52
Sen. Wicker on Biden's infrastructure plan: Not ruling out tax hike
Representative Matt Gaetz (R-FL) arrives for a House Armed Services Subcommittee hearing with members of the Fort Hood Independent Review Committee on Capitol Hill on December 9, 2020 in Washington, DC.
Samuel Corum/Getty Images
Representative Matt Gaetz (R-FL) arrives for a House Armed Services Subcommittee hearing with members of the Fort Hood Independent Review Committee on Capitol Hill on December 9, 2020 in Washington, DC.
Now playing
03:02
Sources say Gaetz was denied meeting with Trump
CNN
Now playing
07:27
CNN anchor pushes back on Texas state lawmaker's defense of voting bill
CNN
Now playing
01:12
Tapper asks Buttigieg for infrastructure plan timeline
Now playing
02:48
GOP governor calls Trump's RNC remarks 'divisive'
WASHINGTON, D.C. - APRIL 19, 2018:  The U.S. Supreme Court Building in Washington, D.C., is the seat of the Supreme Court of the United States and the Judicial Branch of government. (Photo by Robert Alexander/Getty Images)
Robert Alexander/Getty Images
WASHINGTON, D.C. - APRIL 19, 2018: The U.S. Supreme Court Building in Washington, D.C., is the seat of the Supreme Court of the United States and the Judicial Branch of government. (Photo by Robert Alexander/Getty Images)
Now playing
02:39
SCOTUS blocks California Covid restriction on religious activities
rep jim clyburn georgia voting law jim crow sot sotu vpx_00000000.png
rep jim clyburn georgia voting law jim crow sot sotu vpx_00000000.png
Now playing
02:13
Rep. Clyburn blasts GA voting law: It's the 'new Jim Crow'
Gaetz speaks to members of the media outside the hearing Michael Cohen, former attorney and fixer for President Donald Trump, testifies at before the House Committee on Oversight and Reform at Rayburn House Office Building February 27, 2019 on Capitol Hill in Washington, DC. Last year Cohen was sentenced to three years in prison and ordered to pay a $50,000 fine for tax evasion, making false statements to a financial institution, unlawful excessive campaign contributions and lying to Congress as part of special counsel Robert Mueller's investigation into Russian meddling in the 2016 presidential elections.
Alex Wong/Getty Images
Gaetz speaks to members of the media outside the hearing Michael Cohen, former attorney and fixer for President Donald Trump, testifies at before the House Committee on Oversight and Reform at Rayburn House Office Building February 27, 2019 on Capitol Hill in Washington, DC. Last year Cohen was sentenced to three years in prison and ordered to pay a $50,000 fine for tax evasion, making false statements to a financial institution, unlawful excessive campaign contributions and lying to Congress as part of special counsel Robert Mueller's investigation into Russian meddling in the 2016 presidential elections.
Now playing
06:11
'Bombastic, antagonistic, unapologetic': A look at Gaetz's political career
Former House Speaker John Boehner attends a ceremony to unveil a portrait of himself on Capitol Hill, Tuesday, Nov. 19, 2019 in Washington.
Michael A. McCoy/AP
Former House Speaker John Boehner attends a ceremony to unveil a portrait of himself on Capitol Hill, Tuesday, Nov. 19, 2019 in Washington.
Now playing
02:42
Boehner says Republican colleague held 10-inch knife to his throat outside House floor
(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