House leaders have reached a bipartisan compromise on a bill to end the National Security Agency's controversial collection of American phone records. But the measure faces an uncertain future in the Senate.

The House Judiciary Committee has overwhelmingly passed the latest version of a bill known as the USA Freedom Act. The vote was 25 to 2.

The bill would codify President Barack Obama's proposal to end NSA collection of domestic calling records. Instead, it would allow the agency to request certain records held by the telephone companies under a court order in terrorism investigations.

The authority to collect those records and other surveillance provisions of the Patriot Act will expire June 1 unless Congress passes a law renewing it.