The U.S. House of Representatives on Wednesday narrowly defeated an attempt — supported by the entire South Carolina delegation — to block the National Security Agency from collecting and storing data from electronic communications used by virtually all Americans. The close margin reflected rising national alarm at the breadth of NSA intrusion into ordinary Americans’ lives — and sounded a warning to the Obama administration.

Too bad the legislative attempt to restrict Big Brother-like methods fell just short.

The vote was held on an amendment to the Defense Department appropriations bill to deny funds, beginning Oct. 1, for the NSA’s implementation of Section 215 of the Patriot Act. That law has been interpreted by this administration as permitting what is called pre-collection of electronic data that might, in the future, become subject to an intelligence probe. Under normal procedure, law enforcement and intelligence agencies had long been required to first identify a target and then gain authorization to collect data on that person’s communications.

The amendment almost passed despite the arguments of House Speaker John Boehner, R-Ohio, and House Minority Leader Nancy Pelosi, D-Calif., as well as the White House, that it would kill a valuable intelligence tool.

A switch of only seven votes would have been sufficient to change the 217-205 outcome. A majority of Democrats, 111-83, voted for the amendment — and against President Obama and Rep. Pelosi. Republicans voted against the measure, 134-94, though many conservative GOP members joined liberal Democrats to voice their disapproval of the sweeping NSA program.

The vote is a clear indication that Congress is close to ending the NSA’s Section 215 program, which must be reauthorized in two years. Rep. James Sensenbrenner, R-Wis., an author of the Patriot Act, told colleagues earlier this month that unless the administration and the NSA recognize they have a problem, “There are not the votes in the House of Representatives to renew Section 215.”

Sixth District Rep. James Clyburn, a Democrat, joined his six Republican colleagues in the South Carolina House delegation in voting to cut off the intrusive program this year. It was a welcome show of bipartisanship in opposition to the spy agency’s over-broad intrusion into personal privacy.

And as Fifth District Rep. Mick Mulvaney pointed out, the administration lacks credibility on the issue.

James Clapper, director of National Intelligence, has admitted to misleading Congress when he told them in March that the government doesn’t gather data on its citizens. The subsequent revelations of fugitive NSA analyst Edward Snowden showed that to be patently untrue.

The Constitution protects against an intrusive government, the terror threat notwithstanding.

Wednesday’s vote revealed that a substantial and growing number of congressmen want to re-establish firm limits to spying on American citizens.

Call it a clear, above-board message to the NSA.