A fire at a historic castle in Japan destroyed the main building of the ancient structure Thursday, authorities said.

Firefighters have been battling the blaze at the Shuri Castle, a UNESCO World Heritage Site located on the southern Japanese island of Okinawa, since early Thursday, the BBC reported. In addition to the main building, the north and south buildings of the castle -- built out of wood -- also burned to the ground, according to Japan Times.

Residents were ordered to evacuate, Okinawa police spokesman Ryo Kochi told The Associated Press.

The castle was built nearly 500 years ago during the Ryukyu Dynasty and was designated Japan's national treasure in 1933, according to the BBC. The Ryukyu Dynasty spanned about 450 years until it was annexed by Japan in 1879.

The original structure was destroyed during the Battle of Okinawa during the latter stages of World War II.

The castle was restored in 1992 as a national park, and was designated as the UNESCO World Heritage site in 2000, according to the AP.

"The cause of the fire has not been determined yet but a security company alarm went off at around 2:30 in the morning," Koch told news agency AFP, the BBC reported.