A 29-year-old man was charged with planning to hijack a plane after a handgun was found in his carry-on luggage as he prepared to board a flight, police said early Friday. Authorities were investigating if he had terrorist links.

The suspect, a Swedish citizen of Tunisian origin, was part of a group of 20 people traveling to an Islamic conference in Birmingham, England, according to police in Vaesteraas, 60 miles northwest of the capital, Stockholm.

Security officers at Vaesteraas airport found the weapon in a toiletries bag when they scanned the man's hand luggage on Thursday, police spokesman Ulf Palm said. The man lived in Stockholm but was not otherwise identified.

"We believe he was going to hijack the plane," Palm said.

Palm would not give details about a possible motive or the weapon, but he said authorities were investigating possible terrorist links.

"We can't rule that out and that is something we're looking into," he said.

The other members of the group -- 18 adults and two children -- were questioned for several hours at police headquarters but had been released and were not suspected of any crime, Palm said. No other details of the group were released.

"We are going to hold back on the information for the nearest future since this is now a criminal investigation," Palm said.

A hearing will be held in a few days to determine if the suspect, who also faced a secondary charge of illegal possession of a firearm, should be kept in police custody pending investigation.

Palm said the suspect was booked on a flight from Vaesteraas to Stansted airport outside London on Ryanair, a no-frills airline based in Ireland.

Several passengers who had already boarded the plane were evacuated while police searched the cabin and luggage compartment. The plane took off just before midnight Thursday.

Police would not say what type of gun was involved or whether it was loaded. Ryanair said 189 passengers were booked on the flight.

A charge of planning to hijack a plane could carry a sentence of six months to life in prison, Palm said.

Airports in Sweden, a Scandinavian nation of 8.9 million people, have tightened security since Sept. 11 attacks against the United States.