A dozen passengers and three flight attendants required medical attention Friday after a can of pepper spray went off inside the cabin of a Hawaiian Airlines plane, the airline said.

Those affected were treated for respiratory issues after the plane landed in Kahului, Hawaii, around 10:30 a.m. local time, an airline spokesman said.

The airline said a passenger had illegally brought pepper spray on board the flight, which originated in Oakland, Calif. The can discharged about three hours into the flight, the spokesman said.

Airline officials said the incident was accidental.

Passengers in the front cabin were forced to leave their seats for more than a half-hour, Hawaii News Now reported, citing Hawaiian Airlines and passengers. One baby threw up, according to a passenger cited by the news outlet.

“To clarify I was in the affected section. First class and premiere section were impacted, we were in premiere. First class got hit hardest. It’s been a wild day,” wrote one Twitter user.

“Worse. We had some crazy chemical in the front of the plane with 2.5hr left,” wrote another user. “Everyone around us starting coughing, eyes burning, etc. Captain has everyone stand in the back for almost an hours. @HawaiianAir had us on a 26year old plane too!”

The flight crew of the Boeing 767, which was carrying 256 passengers and 10 crew members, declared an emergency to get a priority landing at the airport in Hawaii.

The Federal Aviation Administration could not confirm what substance was brought on the plane, but acknowledged that pepper spray is permitted on checked baggage.

The incident is being investigated by the federal Transportation Security Administration (TSA) and Maui police. The individual responsible for bringing the pepper spray on board could face civil penalties of up to $13,000, Hawaii News Now reported.

No additional details were provided.

Earlier Friday, the same flight was delayed after a teenage girl from Oakland sent a photo depicting a fake crime scene "featuring a child-sized mannequin" to other passengers' cellphones, the East Bay Times reported.

The teen and his family were booked for a later flight while officials investigated.

Hawaiian Airlines said the two incidents were not related and the family's baggage had to be located and removed from the plane, which caused a delay.

The Associated Press contributed to this report.