The domestic flight with 118 people on board was hijacked after taking off from Sabha, bound for the Libyan capital Tripoli.
Instead, the Afriqiyah Airways Airbus A320 was diverted to Malta International Airport. It appears the two hijackers are supporters of Libya's late deposed leader, Muammar Gaddafi.
Pictures of them kneeling on the tarmac with their hands up appear to show the moment they were arrested by the Maltese authorities.
All the passengers - including one infant - and a number of the crew had already been released.
Maltese Prime Minister Joseph Muscat initially said that the men had been armed with pistols and a grenade - but later tweeted that the weapons appeared to be replicas.
Mr Muscat said neither of the men, believed to be of Libyan nationality, had made any demands.
He told a press conference: "The two hijackers have been detained in custody and interrogations are ongoing. The rest of the crew and passengers are also being questioned to ascertain events.
"Once this interrogation process is completed over the next few hours arrangements will be made to send the passengers and the crew members back to Libya with another Afriqiyah aircraft."
Shortly before the incident drew to an end, one man emerged from the plane briefly and stood on the plane steps waving a green, Gaddafi-era flag - adding support to earlier suggestions they were loyalists to the former leader, killed in 2011.
Taher Siala, the foreign minister of Libya's internationally backed Government of National Accord, said the hijackers wanted to set up a pro-Gaddafi political party.