After the end of the Western Roman Empire in 476 (traditional date: Julius Nepos died 480 was the last legitimate emperor), Ostia fell slowly into decay as the population of Rome, 700-800,000 in A.D. 400 contracted to 200,000 or less in 500 A.D. The city was finally abandoned in the 9th century due to the repeated invasions and sackings by Arab pirates. A naval battle, the Battle of Ostia, was fought there in 849 between Christians and Saracens; the remaining inhabitants moved to Gregoriopolis a short distance away.