Dvigrad is first mentioned in 879 when the Aquileian patriarch took power, but its existence dates back to prehistory, as part of a former hillfort within the Roman province. Its very name suggests that two cities were originally located here. Today’s ruins are the remains of the northern city of Moncastello, while another, Castel Parentino, was abandoned in the 10th century.
Dvigrad was taken over by the Counts of Goričko, and shortly afterwards it was destroyed by the Genoese who were fighting against the new owners, Venice. Many lives and towns were lost in this war, which largely took place in Istria. Castel Parentino was most likely then abandoned, and only Moncastello is being restored. After more than a century of peace, the second half of the 16th century was marked by the constant conflict between Venice and Austria. At that time there was an epidemic of plague, and later malaria, so in 1630 the population left the city and moved to Kanfanar, and only the poorest families remained in Dvigrad. It is recorded that in 1650 the bishop in Dvigrad blessed only three families, and twenty years later the church of Sv. Sofia, which meant that the city was left to the ravages of time.
Today's remains represent a very well-preserved, typical medieval town-castle. It is surrounded by double walls connected by the city gates, three of which are defensive towers. Today's Dvigrad is also dominated by the church of Sv. Sofia which is located at the highest point in the city and has been in the same place since early Christian times. The building with its Romanesque stylistic features took on its present imposing three-nave shape in the 13th century, and in front of it is the main town square with the town palace. In the western part of the city there were rooms for the military crew, while the southwest was intended for craftsmen. The remaining, rather large, space was occupied by houses for ordinary citizens.