Image caption There are 50 Boeing 787 Dreamliners at airlines around the world

All of Boeing's 50 flagship 787 Dreamliners have been temporarily taken out of service amid safety concerns.

The US and European aviation agencies said planes should be grounded while safety checks are carried out on their lithium ion batteries.

They are worried that the batteries could leak, corroding vital equipment and potentially causing fires.

Boeing said it stood by the integrity of the Dreamliner, which has been in service since October 2011.

Grounding aircraft on this scale over safety concerns is rare. The last time the FAA ordered a general grounding of an aircraft model was in 1979, when McDonnell Douglas DC-10s were grounded following a fatal crash.

Who owns Dreamliners? Air India: 6

All Nippon Airways (Japan): 17

Ethiopian Airlines: 4

Japan Airlines: 7

LAN Airlines (Chile): 3

Lot Polish Airlines: 2

Qatar Airways: 5

United Airlines (US): 6

Total: 50 Source: Boeing

A string of issues in recent weeks have raised questions about the 787.

Dreamliners have suffered incidents including fuel leaks, a cracked cockpit window, brake problems and an electrical fire. However, it is the battery problems that have caused the most concern.

On Wednesday, an All Nippon Airways (ANA) flight made an emergency landing because of a battery fault and fire smoke in one of the electrical compartments.

ANA said the battery in the forward cargo hold was the same type as the one involved in a fire on a Japan Airlines Dreamliner at a US airport last week.

Image caption Safety inspectors are looking at a battery taken from an ANA Dreamliner earlier this week

Airlines complying

Later on Wednesday, the US Federal Aviation Administration (FAA) said that airlines must demonstrate battery safety before flights can resume.

The authority added that it had alerted the international aviation community of its airworthiness directive, so that other authorities could take parallel action to cover the fleets operating in their countries.

The European Aviation Safety Agency endorsed the directive early on Thursday.

All eight airlines currently flying Boeing 787s have grounded the planes:

All Nippon Airways and Japan Airways have grounded their combined fleet of 24 787s

United Airlines, the only US airline currently operating Dreamliners, said it would immediately comply with the FAA's directive and would begin re-accommodating customers on alternative aircraft

Chile's LAN announced it would suspend its three Dreamliners from service in co-ordination with the Chilean Aeronautical Authority

Indian aviation regulators ordered Air India to stop operating its 787s

Poland's Lot Airlines, the only European airline currently flying 787s, was due to launch its 787 transatlantic service this week, but cancelled a return flight from Chicago to Warsaw on Wednesday

Qatar Airways, which currently operates five Dreamliners, said it had grounded the planes and was "actively working with Boeing and the regulators to restore full customer confidence in the 787"

Ethiopian Airlines said it was taking its 787s out of service as a precautionary measure

Here in Japan, the 787 investigation is now focused on the plane's electrical system and, in particular, its lithium ion battery pack. Japanese investigators have begun removing the battery pack from the All Nippon Airways plane that was forced to make an emergency landing on Wednesday. They say it is deformed and discoloured, and that a large amount of liquid electrolyte had leaked from the battery on the interior of the plane's fuselage. The electrolyte used in lithium ion batteries is known to be flammable. The US FAA is sending a team to Japan to join the investigation. In a statement, it said such a leak "could lead to damage to critical systems and structures, and there is the potential for fire in the electrical compartment". The company that makes the battery pack is GS Yuasa, Japan's biggest battery manufacturer.

'Every necessary step'

Leithen Francis, from Aviation Week, said airlines had little choice but to take the aircraft out of service temporarily.

"When the FAA issues an airworthiness directive, civil aviation and airlines around the world have to follow [it], particularly in regards to the 787, because it is a US-designed and developed aircraft," he told the BBC.

Boeing said it supported the FAA but added it was confident the 787 was safe.

Chief executive Jim McNerney said: "We will be taking every necessary step in the coming days to assure our customers and the travelling public of the 787's safety and to return the airplanes to service.

"Boeing deeply regrets the impact that recent events have had on the operating schedules of our customers and the inconvenience to them and their passengers."

Mr Francis said the safety concerns could have an effect on airlines currently considering ordering 787s, causing them to choose rival Airbus' A330 instead, which is a comparable aircraft and a proven product.

Lithium ion batteries were already known to have a number of potentially serious safety drawbacks Mark Gregory, Technology correspondent, BBC News What are the battery problems?

Companies on the order books include UK holiday firm Thomson, which was due to take delivery of Dreamliners next month, followed by British Airways and Virgin.

Thomson said Boeing had reassured the airline that it was doing everything possible to get the planes back into service.

"We will await the outcome of the FAA investigation into the 787 Dreamliner. At this time we are still working to our original delivery dates," it said in a statement.

The FAA said it would work with the manufacturer and carriers on an action plan to allow the US 787 fleet to resume operations as quickly and safely as possible.

"The in-flight Japanese battery incident followed an earlier 787 battery incident that occurred on the ground in Boston on January 7, 2013," the regulator said.

"The AD (airworthiness directive) is prompted by this second incident involving a lithium ion battery."

It said the battery failures resulted in the release of flammable electrolytes, heat damage, and smoke, and the cause of the failures was under investigation.

"These conditions, if not corrected, could result in damage to critical systems and structures, and the potential for fire in the electrical compartment," the FAA said.

Boeing is investing heavily in the 787 Dreamliner, and needs to sell 1,100 over the next decade to break even. Together with European rival Airbus it dominates the global airliner market.