NAIROBI, Kenya — The government of South Sudan and rebels loyal to the country’s ousted former vice president signed a cease-fire agreement on Thursday, holding out the prospect of peace after more than a month of fighting that has torn the new nation apart.

Under the agreement, signed in the Ethiopian capital, Addis Ababa, both sides in the conflict promised to lay down their arms. But they have also said that a cessation of hostilities would be a temporary measure, short of a formal peace agreement, and that negotiations would have to continue.

While humanitarian groups welcomed the cease-fire as an opportunity to restore stability, political analysts urged restraint, saying that a cease-fire was only the first step in bringing an end to a civil war that has killed thousands and displaced more than half a million South Sudanese.

“We have to be very cautious,” said Zacharia Diing Akol, director of training at the Sudd Institute, an independent research group in the South Sudanese capital, Juba. “Today is just going to be the first step toward stopping violence, but the long and arduous process of real negotiations are going to begin.”