(CNN) A US Navy ship fired warning shots at Iranian boats on Sunday near the Strait of Hormuz, US Defense officials said Monday.

Five Iranian vessels approached the USS Mahan and two other US ships that were entering the strait, according to accounts from four sources. The Strait of Hormuz is situated between the Gulf of Oman and the Persian Gulf.

The Mahan, a destroyer, fired warning shots and used radio calls, flares, bells and whistles to signal to the ships to stay away. There was no response to the radio calls. A US helicopter overhead dropped smoke grenades.

Pentagon spokesman Capt. Jeff Davis said the boats came "within 900 yards or so" of the Mahan.

"It's somewhat out of character, recently anyway, from what we've seen out of Iran," Davis said.

Referring to other similar encounters, Davis said there had been "a total of 35 in 2016 that were assessed to be unsafe and unprofessional," and he added that "the vast majority of those were in the first half of 2016."

"We had a significant number of these before, they had largely stopped except, you know, this incident and in August seemed to be one-offs," he continued.

Warning shots were fired in that August incident, too.

The incident began with a routine shadowing by one regular Iranian navy ship as the Mahan; the USS Makin Island, an amphibious assault ship; and the USNS Walter Diehl, a replenishment oiler, began to enter the strait toward the Persian Gulf.

Four small inshore attack crafts began harassing the US ships, with six separate approaches by the Iranians over a nine-hour period, essentially the whole period of the transit, sources said.

Only one approach was deemed unprofessional, and that resulted in the firing of warning shots because they approached Mahan at a high speed.

The approach was at 15 to 20 knots and if not stopped at a distance of 500 yards or more could have been dangerous for the US ship, the sources said. As a result, defensive measures were taken.

During the interaction, Iran put up a small unmanned aerial vehicle.

Cmdr. Bill Urban with U.S. Naval Forces Central Command said the Mahan established radio communications with the four crafts from Iran's Islamic Revolutionary Guard Corps Navy and "issued multiple radio and visual warnings to remain clear."

He said the vessels sloughed off the warnings and "continued to directly approach Mahan at a high rate of speed," prompting "three warning shots with a crew-served .50-caliber machine gun."

The ships then "arrested their high-speed approach," Urban said.

Naval Forces Central Command regards the interaction "as unsafe and unprofessional" because of their "high-speed approach on Mahan with weapons manned."

The command cited the vessels' disregard for repeated warnings via radio, audible siren, and ships' whistle.

The incident is the latest tense encounter between the two countries in and over waters near Iran in recent months. These brushes have included Iranian rocket launches, drones flying over US vessels and the capture of US sailors.

They've come against the backdrop of renewed US diplomatic contacts with Iran, which has triggered a political backlash among Iranian hardliners, including Iran's powerful Revolutionary Guard Corps.

In November, a US Navy Seahawk helicopter had what the Navy is calling an "unsafe and unprofessional encounter" with an Islamic Revolutionary Guard Corps patrol boat near the Strait of Hormuz.

The helicopter was flying overhead when the Iranians trained a weapon on it, according to a defense official. The Iranians did not fire. The event took place as the helicopter was escorting the aircraft carrier USS Dwight D. Eisenhower on its way out of the Persian Gulf.

In September, Iran threatened to shoot down two US Navy aircraft as they were flying just inside the strait, a US defense official said. The EP-3 and P-8 planes were in international airspace but "near Iranian airspace."

Earlier in September, seven Iranian fast-attack boats were involved in an unsafe encounter with the USS Firebolt, with one Iranian craft coming to a stop in front of the American ship, a US defense official said.

In August, US Navy patrol craft fired three warning shots at an Iranian Revolutionary Guard Corps boat after US officials said it had harassed that patrol craft.

Another US patrol craft and a Kuwaiti Navy ship were also harassed in the incident, which took place in the northern end of the Persian Gulf.