The officers were returning from a patrol when they came under fire from the gang in the city of Zitacuaro in western Michoacan state, the federal Public Safety Department said in a statement.
An unspecified number of officers were wounded in the attack and were taken to hospitals in Mexico City and the Michoacan state capital, Morelia, for treatment, the statement said. Several assailants were also killed or wounded, but officials did not provide an exact number.
Brutal drug-gang violence has swept Michoacan, a state known for its picturesque colonial capital, beaches and Monarch butterfly sanctuary. The state is a stronghold of La Familia, a cartel known for beheading its rivals and staging bold attacks on government security forces.
Police did not immediately identify the attackers or indicate whether they are suspected of being gunmen for La Familia cartel. But the Public Safety Department did say the assailants picked up their wounded and dead and fled with them, a tactic often used by Mexico's drug cartels.
Michoacan cartel gunmen have been known for staging violent attacks on law enforcement personnel in the past: In 2009, the bloodied and tortured bodies of 12 federal agents were found dumped along a highway in Michoacan in one of the worst single attacks against government forces.
The U.S. State Department has issued a travel warning urging U.S. citizens "to exercise extreme caution when traveling in Michoacan."
Nationwide, more than 22,700 people have been killed in drug violence since the government began its offensive against cartels in late 2006.