Updated

A cease-fire went into force early Tuesday in Yemen's Red Sea port of Hodeida after intense fighting between government-allied forces and Shiite rebels erupted shortly before the U.N.-brokered truce took hold in the contested city, Yemeni officials said.

They said artillery shelling and heavy machine gun fire shook districts in the south and east of the strategic city late Monday in the final hour before the cease-fire took effect at midnight.

The fighting took place as the two sides were declaring their intention to observe the cease-fire agreed to last week during U.N.-sponsored talks in Sweden between the internationally recognized government and the rebels known as Houthis.

Fighting subsided as the cease-fire took effect, with only the sporadic sound of machine guns heard in the city, which handles about 70 percent of Yemen's imports.

Under the agreement, a joint committee led by U.N. officers will oversee the cease-fire and the redeployment of the warring parties' forces out of Hodeida, which is currently controlled by the Houthis. Local authorities and police will run the city and its three ports under U.N. supervision, and the two sides are barred from bringing in reinforcements.

A cessation of hostilities in Hodeida would spare Yemen a significant spike in civilian casualties since the rebels have shown battlefield resilience as much larger government-allied forces backed by airpower tried for months to retake the city. The two sides fought to a stalemate after weeks of ruinous street-to-street fighting in densely populated districts on the city's outskirts.

Yemen's civil war, in which a Saudi-led coalition is fighting on the government's side against the rebels, has pushed much of the country to the brink of famine. U.N. officials say 22 million of its 29 million people are in need of aid.

Speaking Sunday at Doha, U.N. Secretary-General Antonio Guterres warned that if Yemen's humanitarian situation does not improve, 14 million people there will be in need of food aid in 2019, 6 million more than this year.

"There is a high level of hunger in Yemen," he said. "The fact that famine was not yet declared does not in any way diminish our huge concern with the very high level of hunger that exists in Yemen with a number of people dying in very dramatic circumstances."

Last week, an international group tracking Yemen's civil war reported that the conflict has killed more than 60,000 people, both combatants and civilians, since 2016. That figure is much higher than the U.N. figure of 10,000 civilian deaths, and has added to the urgency to find a political resolution for the four-year bloodletting.

The report from the U.S.-based Armed Conflict Location & Event Data Project said more than 28,000 people — both civilians and combatants — were killed in the first 11 months of 2018, an increase of 68 percent from 2017. More than 3,000 were killed in November, the deadliest month since the group started collecting data. It said 37 percent of civilians killed in Yemen in 2018 died in Hodeida.

The figures do not include the last few months of 2014, when the Houthi rebels captured the Yemeni capital of Sanaa and much of the country's north, nor the casualties in 2015, when the Saudi-led coalition joined the war on the side of the government.

The group said it based its figures on news reports of each incident of violence in the war.