During any period when the provisions of this part are in effect the NSA shall exercise such control of ports in the United States and its territories or possessions as may be necessary to meet the requirements of the national security. Control shall be consistent with the orders of the Coast Guard Captain of the Port relating to the safety and security of the port.