diff --git a/mercurial/tags.py b/mercurial/tags.py
index fcf08023c0113a98bb61652cc8e60627390e166a_bWVyY3VyaWFsL3RhZ3MucHk=..cb95716da5fe37a9bd6a8c7da73dc6caf89d5fe7_bWVyY3VyaWFsL3RhZ3MucHk= 100644
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -132,5 +132,7 @@
         if (bnode != anode and anode in bhist and
             (bnode not in ahist or len(bhist) > len(ahist))):
             anode = bnode
+        else:
+            tagtypes[name] = tagtype
         ahist.extend([n for n in bhist if n not in ahist])
         alltags[name] = anode, ahist
@@ -135,6 +137,5 @@
         ahist.extend([n for n in bhist if n not in ahist])
         alltags[name] = anode, ahist
-        tagtypes[name] = tagtype
 
 
 # The tag cache only stores info about heads, not the tag contents
diff --git a/tests/test-tags.t b/tests/test-tags.t
index fcf08023c0113a98bb61652cc8e60627390e166a_dGVzdHMvdGVzdC10YWdzLnQ=..cb95716da5fe37a9bd6a8c7da73dc6caf89d5fe7_dGVzdHMvdGVzdC10YWdzLnQ= 100644
--- a/tests/test-tags.t
+++ b/tests/test-tags.t
@@ -381,4 +381,26 @@
   localtag                           0:bbd179dfa0a7 local
   globaltag                          0:bbd179dfa0a7
 
+Test for issue3911
+
+  $ hg tag -r 0 -l localtag2
+  $ hg tag -l --remove localtag2
+  $ hg tags -v
+  tip                                1:a0b6fe111088
+  localtag                           0:bbd179dfa0a7 local
+  globaltag                          0:bbd179dfa0a7
+
+  $ hg tag -r 1 -f localtag
+  $ hg tags -v
+  tip                                2:5c70a037bb37
+  localtag                           1:a0b6fe111088
+  globaltag                          0:bbd179dfa0a7
+
+  $ hg tag -r 1 localtag2
+  $ hg tags -v
+  tip                                3:bbfb8cd42be2
+  localtag2                          1:a0b6fe111088
+  localtag                           1:a0b6fe111088
+  globaltag                          0:bbd179dfa0a7
+
   $ cd ..