diff --git a/ginger.cabal b/ginger.cabal
--- a/ginger.cabal
+++ b/ginger.cabal
@@ -2,7 +2,7 @@
 -- documentation, see http://haskell.org/cabal/users-guide/
 
 name:                ginger
-version:             0.1.2.0
+version:             0.1.3.0
 synopsis:            An implementation of the Jinja2 template language in Haskell
 description:         Ginger is Jinja, minus the most blatant pythonisms. Wants
                      to be feature complete, but isn't quite there yet.
diff --git a/src/Text/Ginger/Parse.hs b/src/Text/Ginger/Parse.hs
--- a/src/Text/Ginger/Parse.hs
+++ b/src/Text/Ginger/Parse.hs
@@ -231,10 +231,21 @@
 ifStmtP = do
     condExpr <- fancyTagP "if" expressionP
     trueStmt <- statementsP
-    falseStmt <- option NullS $ do
-        try $ simpleTagP "else"
-        statementsP
+    falseStmt <- elifBranchP <|> elseBranchP <|> return NullS
     simpleTagP "endif"
+    return $ IfS condExpr trueStmt falseStmt
+
+elseBranchP :: Monad m => Parser m Statement
+elseBranchP = do
+    try $ simpleTagP "else"
+    statementsP
+
+elifBranchP :: Monad m => Parser m Statement
+elifBranchP = do
+    condExpr <- try $ fancyTagP "elif" expressionP
+    trueStmt <- statementsP
+    falseStmt <- elifBranchP <|> elseBranchP <|> return NullS
+    -- No endif here: the parent {% if %} owns that one.
     return $ IfS condExpr trueStmt falseStmt
 
 setStmtP :: Monad m => Parser m Statement
