Rival sides in Yemen's year-long conflict began a tentative truce overnight on Sunday, saying they were committed to the halt in hostilities despite pockets of fighting in the hours leading up to it.

The conflict between the Yemeni army and rival Houthi rebels has killed more than 6,200 people and triggered a humanitarian crisis in one of the Arab world's poorest countries.

The truce from Sunday midnight (2100 GMT) precedes peace talks on April 18 in Kuwait.

A spokesman for a Saudi-led military coalition, which has been carrying out air strikes over the past year, urged the Iran-allied Houthis to respect the agreement which he said the Yemeni government and the coalition would adhere to.

"But if there is any violation of this ceasefire, we will have the right to retaliate, to assess the situation at that time and take whatever steps are necessary to stop these violations," Brigadier General Ahmed al-Asiri told the Reuters news agency by telephone.

He said Yemeni military officials and some militia representatives had met over the past two days in southern Saudi Arabia to prepare for the ceasefire and had signed agreements on how it would be implemented and monitored.

READ MORE: 'Humanitarian catastrophe' unfolding in Yemen - UN

The rival sides had formed committees to observe the cessation of hostilities and facilitate the delivery of humanitarian aid, he said.

The military alliance will continue to carry out intelligence, surveillance and reconnaissance and monitor the Saudi-Yemeni border, territorial waters and airspace, he added.

A spokesman for the Houthis and their allies said that they were also committed to the truce but also retained the right to respond if it was broken by the other side.

Hours before the fighting was due to stop, heavy battles flared between forces loyal to President Abd-Rabbu Mansour Hadi and Houthi fighters in al-Maton, north of Sanaa, residents said.

'Tired of the destruction'

In the central Bayda province, battles in the districts of al-Sawadiya and al-Zaher killed more than 20 people, local officials and residents said, and fighting continued in the southwestern city of Taiz.

The United Nations hopes that the cessation of hostilities will lead to a more concrete, formal ceasefire with confidence-building measures.

This will be the fourth ceasefire since March 26 last year when the Arab coalition began air strikes to support the government of Hadi, who fled an advance by Shia Houthis and their allies, elite troops loyal to former president Ali Abdullah Saleh.

A breakthrough in Yemen?

Previous ceasefires failed to take hold and negotiations collapsed.

In the capital, controlled for the past 18 months by the Houthis, residents said they desperately wanted this attempt at peace to succeed after two rounds of talks failed last year.

WATCH: Is Saudi Arabia guilty of war crimes?

"I am tired of the fighting, the destruction, everything," Hussein Ali, a 57-year-old government employee, told Reuters news agency.

"The situation is very difficult for people without work, without electricity, without water, and with the fear that, at any moment, bombardment could kill those dear to us."