The U.S. National Security Agency's controversial program for the bulk collection of domestic phone call records has been granted extension for the last time, according to documents released.

Under an order by the secret Foreign Intelligence Surveillance Court, the NSA is now allowed to continue collecting the data for a three-month period until Nov. 28. The permission was extended in June to Aug. 28.

The collection of phone records metadata, which did not include collection of information on the content of conversations, is one of many large-scale surveillance schemes of the NSA that were disclosed by former agency contractor, Edward Snowden. The disclosures led to demands for the reform of government surveillance to protect people's privacy.

U.S. President Barack Obama approved as law in June the USA Freedom Act, legislation that reins in the program by leaving the phone records database in the hands of the telecommunications operators, while allowing only a targeted search of the data by the NSA for investigations.

While some provisions of the Act took effect immediately upon enactment, the ban on bulk collection of call records allowed for a 180-day transition of the program.

After Nov. 28, the NSA's access to phone data collected so far, for the purpose of analysis, will end, according to a joint statement by the Department of Justice and the Office of the Director of National Intelligence on Friday.

The data will, however, not be immediately deleted. If the court approves, the agency aims to keep the data for another three months and give technical personnel access to it "solely for data integrity purposes to verify the records produced under the new targeted production mechanism" permitted by the USA Freedom Act.

The government has also applied to the court for permission to retain certain data to meet its legal obligations in various civil suits that were filed against the NSA phone data program. NSA operatives will, however, not have access to this data for analysis, and the data will be deleted after the legal obligations are met, according to the joint statement.

The FISC's order requires that unless there is a "true emergency" during the transition period, the telephony metadata can only be queried after a "judicial finding that there is a reasonable, articulable suspicion that the selection term is associated with an approved international terrorist organization." The query results must also be limited to metadata within two hops of the selection term instead of three.

In a related development, the U.S. Court of Appeals for the District of Columbia Circuit on Friday reversed a preliminary injunction on the collection of phone records by Judge Richard Leon of the U.S. District Court for the District of Columbia. The judge had earlier ruled that the NSA's bulk collection of domestic phone records likely violated the U.S. Constitution.