TEHRAN, Iran -- In a climactic battle at sea, an Iranian commander orders his forces to open fire on a much larger U.S. fleet, obliterating it with a barrage of rockets, some of which tear American flags from their masts.

The scenario unfolds in "Battle of the Persian Gulf II," a new Iranian animated film more than four years in the making that imagines a devastating response to an American attack on the country's nuclear program.

It might have seemed out of date this time last year, when a nuclear accord reached with world powers had lifted sanctions and raised hopes for a broader rapprochement between Iran and the West.

But now tensions are rising again. President Donald Trump has repeatedly criticized the nuclear deal, and his administration put Iran "on notice" last month after it tested a ballistic missile. Iranians were meanwhile angered over Trump's travel ban, which temporarily barred their entry to the United States before it was blocked by the courts.

Director Farhad Azima says the timing of the film's release is purely coincidental. The movie has begun showing in the city of Mashhad, where it was produced, and will open in other cities in the coming weeks.

The nearly 90-minute film, a sequel to a production about the 1980s Iran-Iraq war, begins with a U.S. attack on an Iranian nuclear reactor. Washington has long warned it would take military action to prevent Iran from developing an atomic weapon, while Iran insists its nuclear program is entirely peaceful.

That sets up a showdown in the Persian Gulf, where the real-life U.S. Navy has accused Iranian forces of harassing its vessels in recent months.

In the film, a character who closely resembles Gen. Qassem Soleimani, head of Iran's elite Quds Force, leads a single vessel against more than a dozen American warships. When a U.S. commander orders him to surrender or die, he replies: ""General, I am not a diplomat, I am a revolutionary!"

He warns that any American soldiers taking part in an attack on Iran "should order their coffins," before his forces destroy the whole U.S. fleet.

The U.S. Navy's 5th Fleet, which is based in Bahrain and is responsible for naval operations in the Persian Gulf, declined to comment on the film when contacted by AP.

The real-life Soleimani has directed Iranian-backed forces in Syria, where they are aiding President Bashar Assad, and Iraq, where they are helping the government battle the Islamic State group. In recent years he has gained near-mythic status in Iran, where he is seen as resisting U.S. hegemony in the region.

Azima says his film cost $250,000 to make, and that producers raised the funds from ordinary people. He said there was no government involvement in the project.

"This is a response to hundreds of (anti-Iranian) American movies and video games," he said. "We are saying that if you fire one bullet against Iran, a rain of hot lead will be poured on your forces."