SAY WHAT: Click the image to watch President Obama's speech and read the full text with analysis from The Post's politics and technology writers.

President Obama’s intention to end the government’s controversial practice of amassing the phone records of millions of Americans faces a tangle of technical, logistical and political problems that defy ready solutions and are largely beyond the president’s control.

Among the challenges is stiff resistance from phone companies that do not want to be told how long to hold their customers’ data if the government does not collect it, especially if that means longer than they do now.

The companies do not have the data-sifting capabilities of the National Security Agency, which holds the records and uses them to sift for terrorist connections.

The political challenges may be particularly daunting. The president says he wants to move the data out of the government’s hands. That has positioned him between two extremes. At one end is an odd mix of tea party Republicans and civil liberties Democrats who want the government to end its bulk collection of Americans’ records, not just shift where the data are stored. At the other end are powerful lawmakers, including the chairmen of the House and Senate intelligence committees, who have resisted any substantial changes.

Obama has tasked Attorney General Eric H. Holder Jr. and Director of National Intelligence James R. Clapper with devising a plan by March 28. But many in the administration have their eyes on a more significant date: In June 2015, the law that authorizes the bulk collection is set to expire, and officials say there is little prospect of renewing that authority amid the public backlash triggered by the exposure of U.S. surveillance programs by former intelligence contractor Edward Snowden.

President Obama is proposing major changes in U.S. policy on conducting surveillance both in the country and abroad. Here are the highlights from his speech in three minutes. (Nicki DeMarco/The Washington Post)

“Congress’s deadline hangs over all of this,” said one administration official was not authorized to discuss the matter and spoke on the condition of anonymity.

The official was referring to the pending expiration of Section 215 of the USA Patriot Act, the law that underpins the program.

In some ways, the NSA controversy presents Obama with the inverse of the political problem he faced with the U.S. military prison at Guantanamo Bay, Cuba. He has spent six years trying to figure out how to shut down that facility. He may now have 18 months to find a way to preserve the NSA’s capabilities.

Using the Section 215 authority, the NSA harvests billions of records daily from phone companies about Americans’ calls: the numbers dialed, and the lengths and times of calls. But the agency does not receive the call content. It stores the “metadata” for five years in an effort to map links to al-Qaeda and affiliates by running the numbers of suspected terrorists against the database.

In a speech Friday, Obama said that this capability could be useful in a crisis. “For example, if a bomb goes off in one of our cities and law enforcement is racing to determine whether a network is poised to conduct additional attacks, time is of the essence,” he said. “Being able to quickly review telephone connections to assess whether a network exists is critical to that effort.”

But some lawmakers are skeptical. They say the intelligence community has not established that the program helped thwart a terrorist attack. That assessment was shared by a White House-appointed review group, which recommended last month that the NSA database be shifted out of the government’s hands.

Some also consider collecting massive amounts of phone data from citizens who have not been accused of wrongdoing a violation of the Fourth Amendment, which bars unreasonable searches.

“The very act of bulk collection of private data is undermining Americans’ constitutional rights,” Sen. Ron Wyden (D-Ore.) said in an interview Saturday. “I think bulk collection constitutes a federal human relations database. When you know who somebody calls, and when they called, that really violates people’s rights.”

Wyden, a member of the Senate Intelligence Committee who has co-sponsored legislation that would end the program, said he made that point to senior White House officials Friday night. “They are very much aware of the concerns, and this is one of the reasons that the president said more work is going to be done,” he said.

The momentum, he said, is with the reformers.

“The one-two punch is not only our side gaining momentum, but we have the clock in our favor,” Wyden said, alluding to the 2015 sunset provisions that could end the program. “We’ve got a good chunk of time to keep building to the expiration.”

Congress will be key to determining whether the NSA bulk collection ends or whether it is transformed — maybe through the use of a third party or mandated data retention by the phone companies.

In the House, Rep. James F. Sensenbrenner Jr. (R-Wis.) said, “The bottom line is real reform cannot be done by presidential fiat.” Congressional action “should be taken to protect Americans’ civil liberties by reining in the NSA, ending bulk collection,” he said in a statement Friday.

Sensenbrenner and Sen. Patrick J. Leahy (D-Vt.) are sponsoring legislation , the USA Freedom Act, in their respective chambers that would outlaw bulk collection. If brought to the floor, most analysts agree, that bill would pass the House. Its prospects are less certain in the Senate.

But knowing that the House has the votes to end the government’s mass collection of data — and could block the renewal of Section 215 next year — has administration officials scrambling to find a solution.

A competing bill, co-sponsored by Senate Intelligence Committee Chairman Dianne Feinstein (D-Calif.) and ranking Republican Saxby Chambliss (Ga.) would codify NSA’s ability to conduct bulk collection under Section 215. But it is not clear when or whether that bill will advance to the floor.

Feinstein’s panel has considered options involving the phone companies and has not found a solution that enables data to be returned quickly, in a usable format, secure from breaches and without false negatives, a Senate aide said. “We haven’t yet identified” a solution that meets Obama’s goal and preserves the NSA’s capabilities, the aide said.

The president acknowledged in his speech that there are no immediate viable solutions. He said some have suggested there might be a way forward through “a combination of existing authorities, better information sharing and recent technological advances.” But, Obama said, “more work needs to be done to determine exactly how this system might work.”

One option, officials said, is to find a technology that allows the government to submit a phone number to be queried against several phone companies’ databases at once.

Although commercial technologies exist to do such data mining, the challenge increases because companies hold the data in different formats and for different lengths of time, former NSA technicians said.

The NSA set up its program, Obama said, to solve the problem presented by al-Qaeda hijacker Khalid Almihdhar, whose calls to a safe house in Yemen the NSA intercepted before the Sept. 11, 2001, attacks. The NSA had the Yemen number, but did not know Almihdhar was calling from San Diego. If it could have run the Yemen number against a database of all calls, the theory goes, Almihdhar’s number should have appeared.

The problem is that phone companies are used to receiving law enforcement requests to search for customers’ records. If they are handed a number that does not belong to a customer, say a number in Yemen, the task becomes much harder.

“It would be an incredibly long process, because basically we would be setting a computer running to search through billions of numbers,” said one industry official who was not authorized to speak on the record. “It would probably take days to comb through the database.”

Nonetheless, Todd Hinnen, a former acting assistant attorney general for national security in the Obama administration, said, “The United States has the best technologists and innovators in the world. I’m confident that if the intelligence community focuses on it and works with companies in the private sector, they can solve that problem.” But, he acknowledged, “the bigger challenges will be the political, economic and policy challenges.”

Obama wants Holder and Clapper to work with Congress and the tech and phone companies to develop a plan, officials said.

“He feels it’s worth it to try and come up with a solution that comes to some middle ground that people can live with,” the administration official said.