The Oki Islands in the Sea of Japan are turning history on its head.

The remote outposts that were used for centuries by medieval rulers to banish rivals have become a model for regional revival as the town of Ama, on one of the four permanently inhabited islets, attracts economic migrants from the mainland.

Through steps including expanding seafood exports, debt reduction and a revamp of the high school to provide a platform for entry to top colleges, the town found a recipe for countering the plight of demographic decline. With about 900 local districts at risk of becoming ghost towns within the next few decades, Ama's success off the west coast of Shimane Prefecture has caught attention from Prime Minister Shinzo Abe's administration — and even from Australian educators.