It was formed in 1672 when Frederick Wilhelm III , the last duke of Saxe-Altenburg died and Ernest I , Duke of Saxe-Gotha ( who had married Frederick Wilhelm 's cousin , Elisabeth Sophie ) inherited his possessions . It was nominally created in 1672 when Frederick William III , the last duke of Saxe-Altenburg , died and Ernest I , Duke of Saxe-Gotha ( who had married Frederick William 's cousin , Elisabeth Sophie ) , inherited the major part of his possessions .