Police officers were attacked with missiles and fireworks after violence flared outside a hotel used to house asylum seekers.