U.S. authorities on Monday sent a harmless gas wafting through the New York subway to study how to deal with a toxic accident or attack in a test that both unsettled and reassured riders on the underground system.

A mix of odorless, inert gases and tracer materials were released in three of the busiest subway stations in the city: Grand Central Terminal, Times Square and Penn Station, U.S. Department of Homeland Security officials said.

Men and women in orange vests let off the gas inside areas cordoned off with yellow "caution" tape as commuters walked by and police stood guard.

RELATED: MTA shows off bus technology that could keep pedestrians, drivers safer

With equipment set up at another 55 subway stations around Manhattan, researchers will take air samples every four hours to see how the gas spreads. They will repeat the process throughout the work week, the department said in a statement.

The test is part of a five-year program that began in 2012 to develop methods to protect urban transit systems in the event of an attack or accidental contamination. Previous tests were conducted in New York, Washington, D.C. and Boston.

"These tests are designed to gather data about how airborne material will travel through subway systems and the trains and how quickly they will move," said John Verrico, a spokesman for the department's Science and Technology Directorate, which sponsored the test along with the Office of Health Affairs.

New York subway riders had mixed feelings about the test, which may have stirred painful memories of the Sept. 11, 2001, attacks that destroyed the World Trade Center in lower Manhattan.

Amy Aziz, an artist from New Jersey, first learned of the study from her boyfriend.

"I've heard that they've done it in the past and it sounds like it should be very beneficial," she said.

Other riders said the test made them uneasy because it reminded them of the vulnerability of the country's largest subway system, with its complex stations and countless ventilation paths.

"It's something that we know is a possibility but we don't want to think about it because we don't want it to become a reality," said Doris Altman, a New York City subway commuter. "But it's really frightening."