U.S. stocks turned lower on Wednesday, following the S&P 500's biggest jump in a year, as investors considered the fatal shooting of a soldier in Ottawa, reports of gunfire in the halls of Canada's Parliament and oil falling to a more-than two-year low.
A military guard died after getting shot at the National War Memorial in Ottawa, with multiple rounds then reportedly fired at the adjacent Parliament building. The gunfire followed increased worry about terrorist attacks in Canada, where a radical jihadist ran over two soldiers in a suburb of Montreal on Monday, killing one.
"It hits close to home, and with everything going on in the world, perhaps it's a contributor," Stephen Carl, head equity trader at the Williams Capital Group, said of the situation in Canada's capital, where lawmakers reportedly had barricaded themselves in their offices.
"You don't know what going on there is Ottawa; as we've seen over the last couple of weeks, people buy protection on news or perceived news out there," JJ Kinahan, chief strategist at TD Ameritrade, said of the CBOE Volatility Index, a measure of investor uncertainty, which jumped 11 percent to 17.87.
Equities began to ease gains as the price of oil turned lower after data had U.S. inventories rising more than expected.
"For the market to regain footing, we need the price of oil to stabilize," said Anastasia Amoroso, global market strategist at J.P. Morgan Funds.
Boeing declined after the plane manufacturer reported quarterly results, as analysts questioned the costs of its 787 Dreamliner; Yahoo rose after the search engine reported quarterly results that topped estimates.
After a 39-point gain and 154-point fall, the Dow Jones Industrial Average ended off 153.49 points, or 0.9 percent, at 16,461.32, with Boeing leading the blue-chip slide.
The shed 14.17 points, or 0.7 percent, to 1,927.11, with energy falling hardest among its 10 major industries.
Around noon, S&P 500 futures and Nasdaq 100 futures "gave up their gains and turned down as oil weakening dragged down many of the oil names," wrote Elliot Spar, market strategist at Stifel, Nicolaus & Company.
"In the very short-term I expect the S&P 500 to back off and test 1,907 to 1,905," Spar added.
The Nasdaq declined 36.63 points, or 0.8 percent, to 4,382.85.
For every share rising, more than two declined on the New York Stock Exchange, where 802 million shares traded. Composite volume cleared 3.7 billion.
U.S. consumer prices climbed marginally last month as energy prices declined, illustrating tame inflation that should allow the Federal Reserve to keep interest rates low for a time.
The Labor Department's Consumer Price Index edged up 0.1 percent in September after falling 0.2 percent the prior month.
"Commodity prices are the main factor keeping a lid on the inflation stats as services inflation remains above 2 percent month after month," Peter Boockvar, chief market analyst at the Lindsey Group, noted in emailed commentary.
On the New York Mercantile Exchange, gold futures for December delivery fell $6.20 to $1,245.50 an ounce and crude-oil oil futures for December turned lower, down $1.97 to $80.52 a barrel, its lowest since June 2012.
The U.S. dollar gained against the currencies of major U.S. trading partners and the yield on the 10-year Treasury note, used in figuring mortgage rates and other consumer loans, rose to 2.221 percent.
On Tuesday, U.S. stocks surged, with the S&P 500 and the Nasdaq Composite extending gains into a fourth day, as investors embraced earnings from corporations including Apple, Texas Instruments and United Technologies.
"After the best day of the year, you tend to have exhaustion of enthusiasm, where people settle in and say, 'wait a minute, we're up four percent in four days. In a week we went from the sky is falling to pressing up to the old highs'," said Art Hogan, chief market strategist at Wunderlich Securities.
"As far as today's concerned, we'll likely consolidate yesterday's gains, and may for a day or two, and after that, it's off to the races again," said Peter Cardillo, chief market economist at Rockwell Global Capital..
Coming Up This Week:
Earnings: Microsoft, Amazon.com, Caterpillar, Celgene, Comcast, Daimler, Eli Lilly, General Motors, MMM, Occidental Petroleum, Juniper Networks, Pandora, Altera, Southwestern Energy, Raytheon, Alaska Air, Dunkin Brands, Sonus, Imax, JetBlue, Under Armour, Southwest Air, Credit Suisse, United Continental, Union Pacific, KKR, Alexion Pharma, Dr. Pepper Snapple
8:30 a.m.: Weekly jobless claims
9:00 a.m.: FHFA Home prices
10:00 a.m.: Leading indicators
Earnings: Bristol-Myers Squibb, Colgate-Palmolive, Ford, UPS, Procter and Gamble, Nasdaq, Delphi Automotive, State Street, Ericsson, Shire
10:00 a.m.: New home sales
More From CNBC.com: