WASHINGTON — The federal privacy board that sharply criticized the collection of the phone records of Americans by the National Security Agency has come to a starkly different conclusion about the agency’s exploitation of Internet connections in the United States to monitor foreigners communicating with one another abroad.

That program, according to the Privacy and Civil Liberties Oversight Board, is largely in compliance with both the Constitution and a surveillance law that Congress passed six years ago.

The board, which Congress made an independent agency in 2007 and became fully operational around the time that Edward J. Snowden began releasing a trove of N.S.A. documents, concluded that the agency largely abided by the rules set out by Congress as it gathered the communications of foreigners, a process that necessarily swept in some emails and phone calls involving American citizens.

The report has been issued just as Congress is considering changes in the laws governing N.S.A. activities. But the legislation, which has passed the House and is under consideration by the Senate, deals largely with the call-records program, which the board and President Obama said in January must be changed. That program involved the agency’s retention of billions of records for all phone calls made from or to the United States; under the legislation, telecommunications companies would retain those records, and the N.S.A. would have access under court orders.