A US navy destroyer fired three warning shots at armed Iranian patrol boats as they sped toward the warship at the entrance to the Persian Gulf, marring a recent period of relatively quiet interactions between US and Iranian forces, the Pentagon said on Monday.

Navy Capt Jeff Davis, a Pentagon spokesman, said a group of four fast-attack boats of the Iranian Revolutionary Guard Corps navy ignored multiple attempts by the crew of the USS Mahan to warn them away.

The Mahan used an audible siren, flashing lights and a ship’s whistle to warn the Iranians, and managed to establish radio communication. The initial warnings were not heeded, prompting the decision to fire three warning shots with a .50-caliber machine gun, Davis said.

The Iranian boats then turned away.

The incident happened Sunday inside the Strait of Hormuz, the narrow waterway at the entrance to the Gulf.

“This was an unsafe and unprofessional interaction,” Davis said.

White House press secretary Josh Earnest said: “These types of actions are certainly concerning and certainly risk escalating tensions.”

US relations with Iran are among the tougher foreign policy issues that President-elect Donald Trump will inherit next week when he succeeds President Barack Obama.

During the campaign, Trump promised to take a harder line on Iran, vowing in September that any Iranian vessels that harass the US navy in the Gulf would be “shot out of the water”.

The incident could be seen as Iranian probing amid uncertainty over how quickly and severely Trump will turn away from Obama’s policy of engaging diplomatically with Iran.

Revolutionary Guard naval forces have typically acted more aggressively against US ships in the Gulf than the conventional Iranian navy, reflecting the more hardline side of Iran’s leadership.

Iranian authorities have arrested several Iranian-American dual nationals, and there have been various maritime incidents since the 2015 nuclear deal reached by the US, Iran and five other nations. American officials often have interpreted these as hard-liner efforts to undermine Tehran’s more moderate president.

Most confrontations with Iranian naval forces in the Gulf do not reach the point of prompting warning shots. The last such incident was on 25 August when the USS Squall fired warning shots in the direction of an Iranian boat in the northern Gulf.

A year ago, Iran detained 10 American soldiers for about 15 hours after their vessel wandered into Iranian territorial waters in the Persian Gulf. The incident, while brief, raised tensions between the two countries after Iran published images of the soldiers kneeling with their hands on their heads.

Davis said that in 2015 and early 2016 there were many unsafe and unprofessional Iranian naval moves in the Gulf, but relatively few lately.

“It’s somewhat out of character, recently anyway, from what we’ve seen from Iran,” he said.