WASHINGTON — The day before Thanksgiving, with the country on high alert for terrorist threats, dozens of armed guards from the Department of Homeland Security and local law enforcement patrolled Union Station here as hundreds of passengers emerged from commuter and Amtrak trains.

But even that big show of force was small compared with the daily security presence at nearby airports, where IDs are checked, bags are scanned for explosives, passengers are screened for weapons, and access to restricted areas is regularly blocked by security personnel.

Since the attacks of Sept. 11, 2001, the federal government has spent hundreds of billions of dollars to protect transportation systems, mostly at airports. But security experts say the overwhelming focus on aviation leaves security gaps in other modes of transportation.

Rail facilities, in particular, remain vulnerable to terrorist attacks, these experts say. Some express fear that a mass shooting, like the recent rampages in Paris and San Bernardino, Calif., could happen aboard a train or at a station.