A loud cheer erupted as a school bell rang for the final time.
Market Place School in Inverurie marked its closure with a special ceremony in the heart of the town.
Staff and pupils are to move into the new Uryside School after the October holidays.
Yesterday, pupils were led to the Market Square by teachers waving purple flags bearing the school’s logo.
Hundreds of proud parents, guardians and grandparents lined the streets and pipers played as the entire school marched into the square.
Pupils also performed five songs, including a crowd-pleasing School Dinner Song.
Market Square was decorated with purple bunting and balloons for the youngsters’ arrival.
Afterwards, pipers led the children back to their playground for the final time, where a confetti canon signalled the school’s closure.
Headteacher Katie Budge said: “Inverurie Market Place School has been a wonderful school and one that holds so many happy memories for all those who have passed through the doors.
“We are proud of our school and we all felt like Market Place deserved thanks, a celebration for everyone; with former and current, pupils, parents, staff and the local community.
“Throughout the term we have researched the history of Market Place School, collated the history, collected artefacts and many wonderful photographs, which we have given to Garioch Heritage Centre for safekeeping and sharing with the community.
“We are all feeling every emotion today. Sadness as the doors close for the final time, happiness as we all hold so many wonderful memories of our time here, and excitement as we prepare to move to our new school, Uryside.”
Market Place School had 280 pupils and has been nearing capacity for the last couple of years.
It is expected by 2018 the school roll will rise to 421 due to the planned housing developments in the surrounding area.
Market Place School was built in 1863 and its first head teacher was Alexander Fowlie.
He taught the boys while his daughter Margaret taught the girls.
Additional classrooms were built on to the school building over the years.
Mr Fowlie was head teacher for 37 years and his daughter became the new head mistress when he retired.
The new £10 million Uryside School is located by the Inverurie to Oldmeldrum road near Osprey Village.
As well as new learning facilities, it will have a new indoor sports hall and two outdoor sports pitches.
Inverurie and District councillor Judy Whyte said she had some great memories of the school.
She said: “I’m a former pupil at Market Place and three generations of my family have all gone to the school – including my father and my three children.
“I have happy memories of the school. It has always had fantastic staff teaching there and it had a great atmosphere too.
“We are excited about the new school but Market Place will be missed.”
Heather Davidson, a former pupil and teacher at the school, watched the closing ceremony.
She said: “I’ve done it all at the school, having started there in 1941, and I started teaching there in 1976. I retired in 2006 but I still do supply teaching there.
“I remember we used to have the boys’ playground and the girls’ playground and you never went into the other side.
“I loved teaching here. It is like the end of an era.”