The Federal Aviation Administration on Wednesday grounded Boeing’s flagship 787 Dreamliner until the company resolves problems with lithium batteries that caught fire in two different aircraft.

Laura Brown, an FAA spokeswoman, said in a statement that the FAA would issue an emergency airworthiness directive to address the fire risk.

"The FAA will work with the manufacturer and carriers to develop a corrective action plan to allow the U.S. 787 fleet to resume operations as quickly and safely as possible," she said.

The directive applies to U.S. operators of the aircraft, and so far only United Airlines falls into that category, with six planes. However, it is likely that international carriers will comply.

“United will immediately comply with the airworthiness directive and will work closely with the FAA and Boeing on the technical review as we work toward restoring 787 service,” the company said in a statement. “We will begin re-accommodating customers on alternate aircraft.”

Boeing president and chief executive James McNerney said in a statement that the company would make every resource available to fix the problem.

"The safety of passengers and crew members who fly aboard Boeing airplanes is our highest priority,” he said. "We are confident the 787 is safe and we stand behind its overall integrity. We will be taking every necessary step in the coming days to assure our customers and the traveling public of the 787’s safety and to return the airplanes to service.”

The FAA directive said that the two incidents resulted in smoke, heat damage and the release of flammable liquids.

"The cause of these failures is currently under investigation," the agency stated. "These conditions, if not corrected, could result in damage to critical systems and structures, and the potential for fire in the electrical compartment."

Eric Doten, an aviation consultant and former FAA senior adviser, said that nobody likes to ground airplanes, but the agency was doing the right thing.

“The bottom line is that they’ve been able to handle the problem,” he said. “Thank goodness.”

Earlier Wednesday, two Japanese airlines grounded their fleets after an All Nippon Airlines Dreamliner made an emergency landing in western Japan. Japan Airlines and ANA together have 24 of the aircraft, nearly half of all the Dreamliners in service worldwide.

Last week, FAA Administrator Michael Huerta and Transportation Secretary Ray LaHood announced a review of the aircraft following a fire in a Japan Airlines plane while on the ground in Boston, but they also said the plane was safe.

The plane relies on its electrical system more than other aircraft, and its use of lithium batteries as part of the power system is novel. They are lighter and more powerful than conventional nickel cadmium batteries in most aircraft. Newer Airbus planes use similar batteries.

The 787, which has been plagued with delays and glitches, is assembled in multiple locations around the world with parts furnished by dozens of companies.

“There are a lot of things that are new with this airplane,” Doten said. “It’s the way we’re going to build airplanes from now on.”

McClatchy reported Tuesday that the FAA’s own research showed that lithium batteries could burn hot enough to melt the lightweight composite material that makes up half the plane, including its fuselage. The agency was concerned enough about the potential of the batteries to catch fire that it issued special rules for their use on the Dreamliner in 2007.

The National Transportation Safety Board is investigating the Boston fire, which occurred in a rear compartment that contains key electrical components. The blaze took 40 minutes to extinguish, and one firefighter was injured. Wednesday’s incident occurred near the plane’s cockpit. All 137 people aboard the plane were evacuated safely.