Police by the mosque in Rutter Street, Walsall following the discovery of the home-made bomb. Photograph: Matthew Cooper/PA

Police confirmed on Sunday that a suspicious object found near a mosque in Walsall was a small home-made explosive device.

A loud bang heard by residents in the Caldmore area of Walsall late on Friday "appeared to be consistent" with the device exploding, according to West Midlands Police.

No one was injured and minimal damage was caused around the device, which was found by a member of the public in an alleyway adjoining the Aisha Mosque and Islamic Centre.

Almost 40 homes near the scene were evacuated as a "precautionary and temporary" after bomb disposal experts were called to the mosque.

Mir Saeed, who lives around 50 yards away from the mosque, said: "I heard a big bang but I didn't think it was anything serious. It sounded like hitting metal with a piece of rock or something."

Supt Keith Fraser, the head of crime and operations for Walsall police, said the incident was being treated as a hate crime but the motive for placing the item near a mosque remained unclear.

"We have launched a full investigation into the suspicious item that has been found, and what's going to be the key to this is the public's help in relation to helping us to understand why that suspicious item was in the area."

He added: "Officers are continuing to work hard to establish what the item is and how it got there but the incident is being treated as a hate crime, although the motive for placing the item near to the mosque remains unclear."

Fraser, who confirmed that the item was now safe and was being examined by experts, added: "There are going to be a number of hypotheses around this suspicious item, what I would ask is that we work with what we know at the moment. The investigation is at a very, very early stage.

"Hypotheses which raise people's concern about what may or may not have happened would not be helpful at this stage. I would ask that we keep things in perspective."

Police said officers have increased patrols in the area and around all places of worship, although the incident is believed to be isolated.

A spokesman for the mosque, Ziaul Haq, said: "We didn't think this item was serious, but called the police. We have beautiful relationships with the local community and we've never had any trouble at all at our mosque. We are not too worried about this and we have every confidence in the police."