Johnson is widely expected to defeat Hunt in the race to become the next Conservative Party leader-and thus prime minister-when the result of the contest is announced on July 23.
"Were I to be prime minister now, would I be supporting military action against Iran?"
Hunt was careful not to give too direct an answer to the question.
"The risk we have is something different, which is an accidental war, because something happens in a very tense and volatile situation", Mr Hunt said.
But Johnson was uncharacteristically frank on the same point, though the former London mayor's reputation for political duplicity suggests he could change his tune once in office. He said the Tehran government is a "disruptive, dangerous, difficult" regime, but military action is not "a sensible option for us in the west".More news: American Kills Girlfriend, Shares Images of Her Body on Net
Johnson said the original tweets expressed sentiments "that went out decades and decades ago".
In reaction to the re-imposition of tough USA sanctions, which have notably targeted Iran's main oil revenue stream, Tehran has scaled back on some of its nuclear commitments under the deal, leading the European parties to the pact to warn it about not fully complying with the terms.
But Johnson's comments, ruling out joining any US -led military action, risk undermining Trump's attempts to pressure Iran to rein in its nuclear ambitions and end its destabilizing activities in the region.
Both the US government and Iran have said they are not seeking a war. Tehran is stubbornly resisting White House efforts to get it back to the table to negotiate a more restrictive agreement.
He also said there was still time to save the Iran nuclear deal and that despite the United States being Britain's closest ally it disagreed on how to handle the Iran crisis.More news: Justin Bieber's wife, Hailey, claps back at Maynard James Keenan
Outraged Iranian leaders called for the vessel's immediate release and threatened retaliation. A British Navy warship last week drove off Iranian patrol boats which were approaching a British tanker as it sailed through the Strait of Hormuz, the latest in a series of military incidents which some believe could lead to all-out war.
Johnson said the tweets were unacceptable.
Last week Kim Darroch, the U.K.'s ambassador to the USA, resigned after Trump reacted angrily to the leaking of confidential cables the diplomat had sent to London criticizing his administration.
Johnson echoed prime minister May, whose spokesman also condemned the tweets earlier on Monday.
He also described Trump's presidency as "dysfunctional", "incompetent", and "inept".More news: Trump mulls ousting Commerce Secretary Wilbur Ross
Both Johnson and his rival, foreign minister Jeremy Hunt, told a debate on Monday they were not willing to accept the so-called Irish backstop, an insurance policy to prevent the return of a hard border between Northern Ireland and the Irish Republic.
- Austin Butler Cast as Elvis Presley in Biopic
- Huawei to invest $3.1bn on 5G network development in Italy
- Taika Waititi To Direct Thor 4; Akira Put On Hold
- Goldman Sachs and JP Morgan beat Wall Street expectations
- Space Jam 2 Has Had A Director Shakeup
- Penguin Duo Removed Again From New Zealand Sushi Sopt
- Europe's GPS rival Galileo suffers outage
- Here's why Piemonte Calcio is joining Serie A in Federation Internationale de Football Association 20
- Judge bars Roger Stone from social media
- Australia to decide on Ashes squad in Southampton trial match