diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 901575434..93f96b2f9 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -233,7 +233,8 @@ elementToHtml opts (Sec level num id' title' elements) = do
then toHtmlFromList stuff
else if writerSectionDivs opts
then if writerHtml5 opts
- then tag "section" << stuff
+ then tag "section" ! [prefixedId opts id']
+ << stuff
else thediv ! [prefixedId opts id'] << stuff
else toHtmlFromList stuff