In 1838 he was sent to a prison in Mecklenburg-Schwerin , and he spent two years in the fortress of DÃ mitz . Reuter was set free in 1840 , when Frederick William IV became king of Prussia . In 1838 , through the personal intervention of the Grand Duke of Mecklenburg , he was delivered over to the authorities of his native state , and he spent the next two years in the fortress of DÃ mitz , but was set free in 1840 , when an amnesty was proclaimed after the accession of Frederick William IV to the Prussian throne .