Commerce Secretary Wilbur Ross, whose department overseas the U.S. Census (Saul Loeb/AFP/Getty Images)

Census advocates got an unexpected surprise Wednesday night when the House’s $1.3 trillion spending bill for fiscal year 2018 included more funding for the Census Bureau than they had expected or even dreamed of asking for.

The bill, which the House passed on Thursday, allocates $2.814 billion for the Census Bureau, nearly double the 2017 funding level of $1.47 billion, and $1.13 billion more than the administration’s adjusted request for 2018.

The news left Census watchers flabbergasted.

“When I found out about it yesterday I almost fell out of my chair,” said John Thompson, who resigned in May as director of the bureau amid controversy over funding. “One thing that it sure says is that they recognize that the Census is important, on both sides of the aisle.”

The constitutionally-mandated count determines the distribution of congressional seats, affects the shape of districts and helps decide the flow of hundreds of billions of dollars a year in federal funding. The survey of all people living in the United States and its territories every 10 years is also used by businesses, civic organizations and others whose work relies on demographic data.

Every decade in the years leading up to the count, funding for it is ramped up significantly as money is spent on extensive testing, hiring, and publicity. But in recent budgets, funding had flatlined, leading to fears that to get an accurate count the bureau would later have to play catch-up, costing more in the long run.

In recent months Census advocates have rallied for more funding, warning that a shortfall could jeopardize the survey. The spending bill allocates nearly one billion dollars over what they had recommended.

Advocates hailed the funding but warned that the ramp-up would need to continue in 2019 and 2020.

“The dismal trend of many years of underfunding 2020 Census preparations has finally been reversed with bipartisan support in Congress,” said a statement from The Census Project, a watchdog organization. “The Bureau now has the minimum resources needed to prepare for its Constitutional mandate. However, the FY2019 funding level will be critical, and supporters of a full, fair, and accurate count will remain vigilant.”

In a House Appropriations Committee hearing Tuesday Secretary of Commerce Wilbur Ross said the president has requested $3.8 billion for the Census Bureau for fiscal year 2019, $3.1 billion of which would be for the 2020 count. To mirror previous cycles, funding for 2020 would need to be roughly double that amount in order to stay on target. Census advocates have requested $3.9 billion in 2019 for the decennial count alone.

Vanita Gupta, president and CEO of The Leadership Conference on Civil and Human Rights who lobbied Congress for more funding in recent days, applauded the funding announcement. She said it would put the bureau back on track toward getting an accurate count — assuming there are no further delays in census planning or other obstacles don’t emerge.

There have been concerns among census advocates that cybersecurity fears could make some people reluctant to answer the census questionnaire online and that lack of Internet access will prevent some households from doing so. Another potential obstacle is the reluctance of some individuals to provide personal information to the government.

Ross has warned of declining national interest in participating in the census. In 2010, 63.5 percent of people voluntarily responded to the initial mailing. In the 1970s and 1980s, initial response was more than 75 percent. The projected self-response rate for 2020 has fallen to between 55 percent and 60.5 percent.

The 2020 Census will rely heavily on online responses, which would be the first shift in basic technology since 1970, when the bureau began using the postal service to collect household population counts.

Reluctance to answer the census questionnaire could be exacerbated if a controversial question on citizenship, requested last year by the Justice Department and endorsed in an email sent out Monday from the Trump reelection campaign, is added to the survey.

Kenneth Prewitt, one of six former bureau directors who signed a letter to Ross warning against adding such a question, called the new funding “encouraging.”

But he said its impact could be lessened if the question were to be added, resulting in less initial participation from people in immigrant communities and higher costs associated with circling back to count them.

“The current budget would be inadequate if there is a lower response rate than what the Census Bureau is counting on,” he said. Sending censustakers out to follow up on households that do not respond costs more money.

The Census Bureau must provide Congress with the final wording of the census questionnaire by March 31.

Correction: A previous version of this story incorrectly identified who Vanita Gupta lobbied.