BEIJI, Iraq—A big victory over Islamic State here provided fresh ammunition for the many Iraqi Shiites who prefer Iran as a battlefield partner over the U.S., despite indications that Washington could soon intensify its battle against the extremist militants.

Shiite militias and politicians backed by Iran have claimed much of the credit for the Iraqi recapture a little over a week ago of the city and oil refinery of Beiji, about 130 miles north of Baghdad. Militia fighters danced and posed for pictures on tanks and armored...