BEIRUT, Lebanon — The Syrian government allowed hundreds of students to leave two besieged areas near Damascus to take their year-end exams over the weekend, even as other suburbs of the capital came under fierce attack.

The government is eager to show that it is still providing services, salaries and pensions amid a devastating war, including to areas it does not control.

On Saturday and Sunday, government forces allowed about 360 students from the rebel-held Damascus suburb of Moadamiyeh, and 68 students from the rebel-held town of Madaya, to travel to government areas to take their high school exams, according to activists and state media.

Both Moadamiyeh and Madaya are besieged by government forces, who have allowed relief groups only limited access, despite reports that civilians have died from starvation and lack of medical care.