diff --git a/django/template/base.py b/django/template/base.py
index eacc29c..a315c05 100644
--- a/django/template/base.py
+++ b/django/template/base.py
@@ -222,10 +222,16 @@ class Parser(object):
                 var_node = self.create_variable_node(filter_expression)
                 self.extend_nodelist(nodelist, var_node,token)
             elif token.token_type == TOKEN_BLOCK:
-                if token.contents in parse_until:
-                    # put token back on token list so calling code knows why it terminated
-                    self.prepend_token(token)
-                    return nodelist
+                for value in parse_until:
+                    # A parse_until value which ends in a ' ' will match any
+                    # token starting with that value, otherwise an exact match
+                    # is required.
+                    if (value == token.contents or value.endswith(' ')
+                            and token.contents.startswith(value)):
+                        # Put token back on token list so calling code knows
+                        # why it terminated.
+                        self.prepend_token(token)
+                        return nodelist
                 try:
                     command = token.contents.split()[0]
                 except IndexError:
