SYDNEY, Dec. 9 (Xinhua) -- Two men who planned to bomb a Shia Muslim prayer hall in Sydney to impress an Islamic State recruiter were jailed for at least 15 years on Friday, local media reported.

Omar Al-Kutobi, 25, and Mohammad Kiad, 27, each pleaded guilty to one count of acting in preparation for a terrorist act at a temple in Sydney's western Guildford suburb but failing to follow through with the attack last year, the Australian Associated Press reported.

In the New South Wales Supreme Court in Sydney's Parramatta area on Friday, Justice Peter Garling sentenced the men to 20 years' imprisonment with a non-parole period of 15 years, noting "they were equal participants in the events", AAP reported.

The pair was arrested during a raid of their western Sydney flat by counter-terrorism police in February 2015. Police found a hunting knife, a machete and a homemade Islamic State flag, AAP reported.

Police acted swiftly, "because they believed a terror attack was imminent", Detective Chief Inspector Darren Sly was quoted as saying.

"I think we were very, very lucky in the circumstances and if it wasn't for the intervention of police there then I think we would have had a terrorist event on our hands," AAP quoted Sly as saying on Friday.

"From a police perspective, we're happy with the sentence.

"I think it sends a good message to the community that we're strong on terrorism."