A Pakistani doctor who the F.B.I. said was intent on joining the Islamic State, either on the battlefield in Syria or as a “lone wolf” in the United States, was arrested on Thursday before boarding a flight at Minneapolis-St. Paul Airport.

The doctor, Muhammad Masood, 28, had been en route to Los Angeles to try to travel to the Middle East by cargo ship, the authorities said. He had initially bought a plane ticket from Chicago to Jordan, but officials said the flight was canceled because of the coronavirus outbreak.

Mr. Masood, who most recently worked as a research coordinator at a medical clinic in Rochester, Minn., was charged with one count of attempting to provide material support to a designated foreign terrorist organization.

The charge carries a penalty of up to 20 years in prison.

Mr. Masood spent the past two years in the United States on a temporary visa, known as a H-1B, that is issued to skilled workers from abroad, a criminal affidavit said.