Six people have been arrested following a siege at a property in the Almondbury area of Huddersfield.
Police were called shortly before 4.30am to Nowell Place, Almondbury, to a report of a man in the street with a machete.
On arrival, officers established that the man was believed to be in a property with a number of others, who refused to leave the address when requested.
An armed containment of the address was put in place and negotiators attended at the scene.
A bag was thrown from a window of the property, which was recovered and found to contain a firearm.
At around 8.40am, three males, aged 16, 19 and 23, and two females, both aged 18, agreed to leave the property and were arrested.
At 10.45am, the remaining occupant of the property made his way onto the roof.
Further negotiations took place, and at 1.13pm, the 21-year-old man made his way down from the roof and was arrested.
All six have been arrested on suspicion of possession of a firearm and are currently in custody.
West Yorkshire police thanked local residents for their patience while officers worked to bring the incident to a safe conclusion.
An investigation is being carried out by Kirklees District CID and any witnesses or anyone with CCTV or mobile phone footage of the incident is asked to make contact via www.westyorkshire.police.uk/contact-us quoting 13190433062.