The United Kingdom has followed the United States in preventing passengers on flights from some countries in the Middle East and Africa from carrying devices such as laptops and tablets in the cabin.

The restrictions affect 14 airlines, six of which are based in the U.K. As in the U.S., the ban covers any electronic devices larger than a typical smartphone.

"The additional security measures may cause some disruption for passengers and flights, and we understand the frustration that will cause, but our top priority will always be to maintain the safety of British nationals," the government said in a statement.

The affected airlines are: British Airways, EasyJet, Jet2.com, Monarch, Thomas Cook, Thomson, Turkish Airlines, Pegasus Airways, Atlas-Global Airlines, Middle East Airlines, Egyptair, Royal Jordanian, Tunis Air and Saudia.

The U.S. and U.K. regulations will affect different points of departure. The new restrictions on direct flights to the U.K. include flights from Turkey, Lebanon, Jordan, Egypt, Tunisia and Saudi Arabia.

But some airports covered by the U.S. ban -- Abu Dhabi and Dubai (UAE), Doha (Qatar), Kuwait City and Casablanca (Morocco) -- are not affected by the U.K. restrictions.

Prime Minister Theresa May is privy to the same information and intelligence as U.S. officials, a government source told CNN before the restrictions were announced. She has discussed security several times with U.S. officials over the past few weeks, the source said.

"We have been in close touch with the Americans to fully understand their position," the U.K. government said in a statement.

British Airways advised passengers traveling from the affected airports to allow plenty of time for check in. It said that flights would continue to operate as usual.

Thomas Cook, which offers vacation packages, told customers that laptops, tablets and e-readers will not be allowed in hand luggage and must be placed in the hold. It said that some large smartphones, including the iPhone 7 Plus, would be allowed in the cabin.

The Trump administration has ordered nine airlines flying from 10 airports in the Middle East and Africa to stop passengers from bringing most types of electronic devices into the cabin for U.S.-bound flights. Instead, they'll have to check them in.

The ban covers any devices bigger than a smartphone -- including iPads, Kindles and laptops.

Related: Airline electronics ban: What you need to know

The indefinite U.S. ban will affect more than 50 flights daily from the airports in the mainly Muslim countries, including major hubs such as Dubai and Istanbul, according to senior U.S. administration officials.

The nine airlines affected by the U.S. ban were notified of the procedures by the Transportation Security Administration at 3 a.m. ET Tuesday and must comply within 96 hours.

It's not clear whether other countries will follow the U.S. and Britain in banning larger electronic devices.

Germany is not currently considering similar measures, according to Annegret Korff, a spokesperson for the country's interior ministry. Korff said that Germany had prior notice of the U.S. regulations.

French authorities did not immediately respond to a request for comment.

This is not the first time that electronic devices have been banned on certain flights.

In 2006, passengers traveling from Britain to the U.S. were allowed to carry only essential items in cabins after intelligence officials discovered a plot to blow up airplanes flying between the countries.

Passengers had to check all items except absolute essentials, such as passports, wallets and eye glasses. All personal items had to be carried in a clear plastic bag and all electronics had to be checked.

The restrictions, which were eased after about five days, led airport security times to increase fourfold and caused significant delays and cancellations.

-- Carol Jordan and Alanna Petroff contributed to this article.