A video released by the Coast Guard shows the dramatic rescue of two pilots from a downed aircraft off the Hawaiian coast Friday. 

The Boeing 737 inter-island transport plane was two miles south of the island of Oahu. The Coast Guard was called about a downed aircraft around 1:40 a.m. 

When a Coast Guard helicopter arrived, one of the cargo plane's pilots was on the tip of the aircraft's tail and the other was in the water on a cargo load, Hawaii News Now reported. 

"We first saw a man waving his hands from the tail of the airplane," Coast Guard Lt. Gleb Borovok told the news outlet. "Another man was floating on a bed of cargo."

COAST GUARD RESCUES KAYAKER AIMING FOR HAWAII 70 MILES OFF COAST

A video released by the Coast Guard shows the rescue of two downed pilots.  (Coast Guard )

He said the crew initially planned to rescue the pilot in the water first but things changed when the tail of the plane disappeared and the man who was hanging on was in the water appearing to struggle. 

One of the pilots was airlifted to a hospital and the other was taken to shore by a Honolulu Fire Department boat and transported to a hospital. Both are in stable condition, the Coast Guard said. 

"Our crews often train closely with our counterparts in the Honolulu Fire Department for situations just like this one," said Petty Officer 2nd Class Masato Nakajima, a Sector Honolulu watchstander, in a news release. "That training paid off and we were able to quickly deploy response assets to the scene and recover the two people aboard the aircraft."

CLICK HERE TO GET THE FOX NEWS APP 

The cause of the incident is under investigation.