Iranian boats closely shadowed an American warship in the Persian Gulf on Friday, underscoring the potential for renewed maritime hostility between the United States and Iran.

Two fast attack boats under the command of the Iranian Revolutionary Guard Corps came within 300 yards of the USS Essex during a visit by Gen. Joseph Votel, who commands U.S. forces in the Middle East. A reporter from The Washington Post observed the boats as they sped near the amphibious assault ship, currently the largest U.S. ship in the gulf.

The incident, which did not appear linked to the general’s visit, illustrates the delicate course the U.S. military must navigate as the Trump administration ratchets up pressure on Tehran and prepares to reimpose punishing sanctions.

The Iranian boats trailed the Essex, but U.S. officials said they did not undertake the same level of threatening behavior Iranian boats have in the past.

American reports of harassment by Iran’s naval forces, sometimes resulting in U.S. ships firing warning shots, became common at the end of the Obama administration but dropped off in the months after President Trump took office.

Votel, speaking to reporters who accompanied him to the Essex, said the Iranian activity Friday did not rise to the level of what naval officials consider to be “unsafe and unprofessional.” He said the Essex’s crew responded in a way that minimized the risk of escalation.

“Iran is always a concern, and so we will be vigilant as we always are, not just here in the maritime environment but really across the theater,” Votel said. “Because we have to be.”

Naval officials said Iranian ships regularly conduct similar maneuvers around the Essex, often multiple times a week. According to the officials, a total of six Iranian craft — two Cougar-class patrol boats, two Kuch-class patrol boats and two Peykaap-class coastal patrol boats — approached the Essex Amphibious Ready Group on Friday.

Military officials in the Persian Gulf and elsewhere in the Middle East are trying to curtail Iran’s military influence without triggering a direct confrontation. Votel has described the military’s role as indirect, as it backs the Iraqi army, a Kurdish-dominated partner force in Syria and other allies to block Iran’s regional buildup.

But the stakes of small encounters have increased as Trump’s top advisers elevate their goal of diminishing Iran’s ability to project military power. So far, the Trump administration has slapped tough economic measures on Iranian affiliates and pulled out of the multinational nuclear deal signed during the Obama administration. On Nov. 4, sanctions are set to be re­imposed on Iran’s energy sector. Some critics fear the tougher U.S. stance could reignite open conflict with Iranian-backed militias, similar to what occurred in Iraq after the 2003 invasion.

In the gulf on Friday, officials on the Essex said the boats appeared to be collecting information about the U.S. ship, using cameras and studying its behavior. Capt. Gerald Olin, commander of the Essex Ready Group, said his ships used loudspeakers to respond to Iranian crafts operating nearby.

In a sign of the risks of such encounters, a senior officer aboard the ship informed Votel that the Iranian personnel, in their radio communications with the ship, had threatened to shoot at a U.S. helicopter being flown off the Essex if it continued to operate near their boat, according to footage shot by NBC News.

The Essex plays an important role in the U.S. naval presence in the Middle East at a moment when the Pentagon has no aircraft carriers in the region, raising questions about how the U.S. posture will be affected by the administration’s shift toward military competition with China and Russia. Votel and other officials said the U.S. footprint remains strong across maritime air and naval forces, especially when considered in combination with allied militaries.

Last month, the Essex launched the first-ever combat mission for the F-35B Lightning II, the Marine version of the military’s most advanced plane, highlighting the role of the Essex Group and the 13th Marine Expeditionary Unit in the U.S. battle against insurgent groups.

The F-35 Joint Strike Fighter program, which has been plagued with technical and production issues, has come to symbolize the pitfalls of the Pentagon’s massively expensive weapons development initiatives. Last month, the F-35 suffered its first crash ever when a Marine jet went down in South Carolina, prompting a temporary grounding of part of the fleet to handle potential flaws.

The Marine version of the jet can take off from the deck of a shorter ship and can land vertically, like a helicopter. The debut mission from the Essex resulted in a strike on a militant target in Afghanistan.