The National Security Agency (NSA) survived a legislative challenge in the House this week. But senior NSA officials still face an uphill fight to convince the American public that the agency’s operations can enhance security without jeopardizing privacy.

The Obama administration had to lobby aggressively to defeat a bipartisan proposal to defund the NSA’s collection of Americans’ telephone call records. The narrow 217 to 205 vote shows how fragile public support has become for the agency’s surveillance programs.

Gen. Keith Alexander and other top NSA officials are considering ways they could reassure the public without damaging key programs, according to U.S. officials. They think that forcing Congress to decide between security and privacy is an unfair choice, since the country would lose either way. They’d like an agreement that protects both, but that’s a tall order.

The controversial program the House nearly voted to kill allows the NSA to obtain metadata — basically the numbers of all telephone calls — from all major U.S. telephone providers. The companies are compelled to furnish this information by orders issued in secret by the Foreign Intelligence Surveillance Court. The call records are held for five years.

The reason the NSA wants this vast library of records is to have a complete inventory to check for calls from suspected terrorists overseas. When the agency identifies a suspicious number in, say, Pakistan, analysts want to see who that person called in the United States and who, in turn, might have been contacted by that second person. It’s like having a full deck of cards so that you can match any particular one if you need to.

The widespread fear that the NSA is recording the calls themselves is false, the officials say. “It would take 400 million people to listen and read” global traffic, one official estimates — obviously an impossibility.

To NSA officials, this access to calling records is supremely valuable. The problem is that many Americans are uncomfortable with it, despite repeated NSA assurances that, under the program, only the calling data are collected, not the calls themselves. Public uneasiness was suggested by a Washington Post-ABC News poll this week showing that 74 percent of those surveyed believe NSA surveillance of telephone records intrudes on the privacy rights of some Americans.

So how could the NSA reassure the American public? The agency keeps the calling records in what’s described as an electronic “lockbox” that can only be accessed by a small number of people when there is a “reasonable, articulable suspicion” that numbers need to be checked. What other protections could be offered? The U.S. officials cite three issues:

●Who should hold the calling data? Under current procedures, it’s turned over to the NSA and stored in government data files. The records could instead be retained by the phone companies and accessed only when there’s a particular need, described in a legal order. Or the records could be held by a third party — a consortium like the SWIFT system that handles bank transfers.

This approach avoids the “Big Brother” connotations of government control, although it has two problems. First, private companies may not want the hassle of acting as keepers of surveillance records. And second, the records might be accessed by self-appointed whistleblowers or disgruntled employees with private scores to settle.

●How long should records be held? The NSA could purge them earlier than five years, but officials worry that the shorter the retention period, the less effective the metadata will be as a way of tracking dangerous links.

●How can oversight be improved? The NSA thinks the rules are already pretty good, with Congress and the courts joining the executive branch in detailed reviews of compliance with the law and its privacy protections. Judging by the poll data, the public isn’t convinced. Greater transparency — at the Foreign Intelligence Surveillance Court, in the congressional intelligence committees and at the NSA itself — would help. In reality, however, no level of scrutiny would be tight enough to reassure everyone.

Ann Telnaes animation: Comparing the coverage of Anthony Weiner and the NSA scandals. (Ann Telnaes/The Washington Post)

A final, delicate challenge for the NSA is maintaining its relationships with telephone companies that are anxious about customer and shareholder concerns and are in litigation challenging the program. U.S. officials believe the best defense for the companies is simply to claim that they have no other choice — that they are compelled by legal orders to give up the data.

But the companies would be happier, surely, with a softer, more transparent and customer-friendly wrapper for a program that makes many Americans nervous.

Read more from David Ignatius’s archive, follow him on Twitter or subscribe to his updates on Facebook.