We present simulations investigating the role of the tail of a spherical viral capsid (mimicking a bacteriophage) on the ejection dynamics of a semiflexible polymer (representing viral dsDNA). We compare the ejection dynamics of a neutral polymer with that of a charged one. We find that the presence of the tail markedly slows down ejection. Our simulations suggest that this is because the last few polymer sections are trapped in the tail. Such trapping is particularly efficient for a charged polymer where the entropy of the part of the polymer outside the capsid is greatly reduced making complete ejection of the last few polymer sections difficult. Lowering the temperature further enhances this trapping.