The U.S. military showcased its "awesome firepower" last week in the Persian Gulf, officials said, the same day it warned vessels in the Mideast against approaching within 100 yards of its warships after encounters with Iranian gunboats.

A U.S. Air Force AC-130 gunship engaged in live-fire training in the Persian Gulf with the USS Bataan Amphibious Ready Group (ARG) and embarked 26th Marine Expeditionary Unit (MEU) between May 19 and 21, military officials said Saturday in a news release.

US NAVY WARNS MARINERS IN GULF TO STAY AWAY OR BE INTERPRETED AS A THREAT, AFTER IRAN ENCOUNTERS

“This was a great opportunity to incorporate the awesome firepower of the AC-130W into our Navy-Marine Corps live-fire training, rehearsing swift and lethal strikes with pinpoint accuracy against surface targets representing notional threats to the ARG/MEU,” said Capt. Lance Lesher, commander of the Bataan ARG.

An Air Force AC-130W assigned to Joint Special Operations Air Component engages a target utilizing aviation-delivered fires during an aviation operation in support of sea control training evolution May 21, 2020.

An Air Force AC-130W assigned to Joint Special Operations Air Component engages a target utilizing aviation-delivered fires during an aviation operation in support of sea control training evolution May 21, 2020. (U.S. Marine Corps photo by Staff Sgt. Patricia A. Morris)

“This complex coordination involving SOCCENT, Marine Corps and Navy forces further expands our capability to defend ourselves against any threats we might encounter while operating lawfully in support of maritime security and our regional partners in the Arabian Gulf,” Lesher continued.

The live-fire training began on the same day that U.S. military warned Iran to keep back 100 yards from its warships last week after harassment by small gunboats from the Islamic Revolutionary Guard Corps last month.

The 11 Iranian vessels came close to U.S. Navy and Coast Guard ships in the Gulf, in what the U.S. military called “dangerous and provocative” activity. Iranian vessels came within 10 yards of the U.S. Coast Guard cutter Maui during the incident, the U.S. military said.

An Air Force AC-130W assigned to Joint Special Operations Air Component passes over the amphibious transport dock USS New York (LPD 21) during an aviation operation in support of sea control training evolution May 19, 2020.

An Air Force AC-130W assigned to Joint Special Operations Air Component passes over the amphibious transport dock USS New York (LPD 21) during an aviation operation in support of sea control training evolution May 19, 2020. (U.S. Marine Corps photo by Staff Sgt. Patricia A. Morris)

President Trump later threatened Iran on Twitter, saying he would “destroy” them if the harassment continued.

In recent years, Iranian vessels have been accused of harassing U.S. ships in the Persian Gulf and Strait of Hormuz, which sees 20 percent of the world’s oil pass through.

An Air Force AC-130W assigned to Joint Special Operations Air Component marks a target with an infrared laser during an aviation operation in support of sea control training evolution May 19, 2020.

An Air Force AC-130W assigned to Joint Special Operations Air Component marks a target with an infrared laser during an aviation operation in support of sea control training evolution May 19, 2020. (U.S. Marine Corps photo by Staff Sgt. Patricia A. Morris)

Tensions have been high between Iran and the U.S. ever since Trump unilaterally withdrew the U.S. from Tehran's nuclear deal with world powers in 2018.

CLICK HERE FOR THE FOX NEWS APP

Last summer saw a series of escalating attacks targeting oil tankers and other sites around the Persian Gulf. It reached a crescendo in January with the U.S. drone strike in Baghdad that killed Iranian Gen. Qassem Soleimani and an Iranian ballistic missile strike of American forces in Iraq in retaliation.

Fox News' David Aaro and The Associated Press contributed to this report.