The would-be hijacker who was shot and killed by commandos after attempting to commandeer a flight to Dubai on Sunday was carrying a fake weapon and had a criminal history stemming from a kidnapping case, officials said Monday.

The Biman Bangladesh Airlines Boeing 737-800 made an emergency landing Sunday in the southern port of Chittagong, Bangladesh, where commandos stormed the plane. The hijacking took place after takeoff from Dhaka when a man on the flight reportedly waved a gun and attempted to enter the cockpit.

Mufti Mahmud Khan, director of the law and media wing of Bangladesh's Rapid Action Battalion security agency, told reporters at a news conference the suspect was listed in its database as 24-year-old Md. Polash Ahmed, who was from a village near the capital.

DUBAI FLIGHT FORCED TO MAKE EMERGENCY LANDING AFTER ATTEMPTED HIJACKING; SUSPECT DIES OF INJURIES IN SHOOTOUT

The police chief in Narayanganj outside Dhaka, Mohammed Moniruzzaman, first identified the suspect as 24-year-old Mohammed Polash Ahmed, according to the Associated Press. Moniruzzaman said Ahmed's parents confirmed his identity, and that residents of the village where he lived said he had a "bad reputation."

A passenger on the flight reported Ahmed may have fired a weapon twice, but civil aviation authority chairman Air Vice Marshall Nayeem Hasan said the gun wasn't real, Agence France Presse reported.

"According to those who have seen it, it appears that the gun was fake," he said Monday.

Kusum Dewan, additional commissioner of Chittagong police, said that Ahmed appeared to be "mentally imbalanced," according to Reuters.

"We heard he had a personal issue with his wife and demanded to speak to the prime minister," he said. "But we are still investigating. We don’t want to come to any conclusions right now.”

Officials said the 24-year-old had been arrested in 2012 in connection with a kidnapping case, but did not provide additional details.

INDIA'S FASTEST TRAIN BREAKS DOWN ON ITS FIRST TRIP

The investigation into the attempted hijacking is now centered on how Ahmed managed to board the flight with the pistol.

Bangladesh civil aviation minister Mahbub Ali told reporters that Ahmed had booked a seat on the flight from Dhaka to Chittagong, and that airport surveillance video showed him going through security with other passengers.

"There was no signal that he had something" when he boarded Sunday's flight, Ali said.

Khan said when the agency's bomb-disposal unit reached the scene, they found that Ahmed had fake "bomb-like material."

CLICK HERE FOR THE FOX NEWS APP

Bangladesh, a majority Muslim nation of 162 million people, has had periodic terrorist attacks in recent years, including an assault on an upscale cafe in Dhaka's diplomatic enclave in 2016 that resulted in the deaths of 22 people, including 17 foreigners.

The Associated Press contributed to this report.