centering multiple lines of text


I am having trouble with centering multiple lines of text. I add
new BBTag("center", "<div style=\"text-align:center\">", "</div>"),
to _AllowedTags.

My input is:
[center]line 1[br] [b]Line 2 (Bold)[/b] [br] line 3 [/center] [br] [br][br]This line should not be centered[br], should be left justified.

Only lines 1, 2 and 3 should be centered, the last line should not be. The html this is output is:
<div style="text-align:center">line 1<br /> <b>Line 2 (Bold)</b> <br /> line 3 [/center] <br /> <br /><br />This line should not be centered<br />, should be left justified< /div>

It appears to be placing the closing div at the end of the text, rather then at the [/center]. Any help appreciated.

If I do [center]line[/center] [center]line[/center] [center]line[/center]
This does work OK.