The Castle of Longiano did not exist in V th century and its foundation can be dated between VII and VIII century. An ancient parchment dated 1059 attests that an important defensive castle had been built up in the zone.
Longiano became more and more important and was allied with Rimini in defending their territories. For this reason in 1198 the Castle of Longiano was almost entirely destroyed; later, with the aid of Rimini, the castle was reconstructed and fortified: meanwhile Longiano and Rimini stipulated an oath of fidelity and mutual aid.
In 1216 an attack from Cesena was repulsed and the enemies were defeated.
As Malatesta's power in Rimini grew up, even Longiano followed the same fate. Giovanni Malatesta, called "the crippled", became the first duke of Longiano in 1290.
In 1297 Cesena, Forlė,Faenza and Imola set afire the village of Longiano beneath the Door of the Bridge (Porta del Ponte) and even now it is called "Burnt Village".
Afterwards the Malatesta's added new bastions and magnified the fortress (that still now is visible) in order to fortify the castle.
From 1290 to 1463 the castle was a possession of the Malatesta's, from 1463 to 1519 it belonged to the Church and it was governed by the Vicars. In 1503 the troops of Cesare Borgia conquered the village and burnt the archives because the community refused loyalty to the new Lord of Romagna. After 4 years of dominion by Venice (the fountain in the court remains the only testimony of this period) on 16Th September 1519 Pope Leone X gave Longiano to Count Guido Rangone of Modena as a perpetual possession.
Guido Rangone was generale counselor of Francesco I, King of France, during the war against Emperor Charles I, and was also a protector of artists and men of letters.
In 1581 these territories returned under the possession of the Curch till the arrival of General Bonaparte in 1790.
Bonaparte occupied with his army the whole of Romagna until 1814.
After the union of Italy in 1862-1863 the inside of the castle was totally restructured with the decoration of the "Sala dell'Arengo" (Arengo's room) and the adiacent rooms by Giovanni Canepa and Girolamo Bellami.
Famous men in Longiano's history are painted on the ceiling of these rooms.
During the last world war Longiano was a strategic point in the Gotic Line and suffered violent bombardments that produced serious damages expecially to the Sanctuary and to the historical library.