Until the House of Lorraine took over from the Medici , Tuscany was a state of the Holy Roman Empire until the Peace of Westphalia in 1648 . Until the advent of the House of Lorraine , Tuscany was nominally a state of the Holy Roman Empire until the Peace of Westphalia in 1648 .