The Canadian dollar weakened against its U.S. counterpart on Thursday, as White House drama and an attack in Barcelona reduced investor appetite for the loonie after it hit a nearly two-week high earlier in the day.

A U.S. official said Gary Cohn intends to remain in his post as head of a White House economic council, after speculation earlier in the day of Cohn's possible departure rattled the U.S. stock market and the U.S. dollar.

"People are rushing into the U.S. dollar out of Canada, but they are also rushing out of the U.S. dollar into the euro, gold, Swiss and yen," said Eric Theoret, a currency strategist at Scotiabank. 

"The Cohn rumours and this Barcelona episode are adding onto a market that is already tentative," he said, following last week's tensions over North Korea.

Meanwhile, a van mowed through crowds of tourists on Barcelona's most famous promenade, killing about a dozen people in an attack that was claimed by Islamic State.

At 4 p.m. ET, the Canadian dollar was down 0.4 per cent at $1.2676 per U.S. dollar, or 78.89 cents US. 

The loonie had rallied more than one per cent on Wednesday as U.S. Federal Reserve concerns over inflation and the disbanding of U.S. President Donald Trump's manufacturing council and strategic policy forum weighed on the greenback.

The currency's weakest level of the session was $1.2647, while it touched its strongest since Aug. 4 at $1.2588.

Theoret said he expects further Canadian dollar strength heading into a Bank of Canada meeting in October as the market positions for a possible interest rate hike.

Domestic inflation data is due on Friday, with a lower-than-expected print unlikely to weigh on the currency as much as a surprisingly strong number would boost it, Theoret added.

Canadian factory sales were down by 1.8 per cent in June from May, with declines for petroleum and coal products, transportation equipment, and chemical industries, Statistics Canada said. Analysts had forecast a decrease of 1.0 per cent. 

Canadian government bond prices were higher, with the two-year up half a cent to yield 1.230 per cent and the 10-year adding 19 cents to yield 1.849 per cent.