The government of Ecuador has condemned what it described as an attempt by a US federal immigration agent to enter the Ecuadorean consulate in Minneapolis.

The agent was prevented from gaining access by consular officials, who acted to guarantee the protection of the Ecuadoreans who were inside the consulate at the time, a statement by Ecuador's foreign ministry said.

Ecuador, whose president is an ally of Trump, has filed an official complaint.

The incident comes at a time of high tension in the US city, just days after intensive care nurse Alex Pretti was shot dead by border agents during protests against the Trump administration's immigration crackdown in Minneapolis.

Ecuador's foreign ministry said in a statement that an agent of the US Immigration and Customs Enforcement agency (ICE) had tried to enter the premises of the consulate at 11:00 local time (17:00 GMT) on Tuesday.

Under the 1963 Vienna Convention on Consular Relations, consular premises are considered inviolable. According to the Convention, the authorities of the country where the consulate is located shall not enter the parts of the consulate used for work except with the consent of the head of the consular post.

Ecuador said that its officials had not consented to ICE entering the consulate. The Vienna Convention states that consent may only be assumed in specific emergencies requiring prompt protective action, such as fire or other disasters.

In a video shared by Ecuadorean media, not independently verified by the BBC, a consular official is seen preventing the ICE agent's entry. The agent warned, if you touch me, I will grab you; to which the official responded that this is a foreign government office, before closing the door.

Ecuador's foreign ministry confirmed an official letter of protest was delivered to the US embassy in Quito, which marks a rare note of discord between Ecuadorean President Daniel Noboa and the Trump administration, despite their recent agreements to strengthen bilateral relations.

This incident underscores the ongoing tensions surrounding immigration enforcement in the US, especially following the recent violent incidents in Minneapolis that have triggered protests against immigration policies.