BEIRUT, Lebanon — They call each other meddlers, warmongers, religious hypocrites, zealots and sponsors of terrorism. Now Iran and Saudi Arabia, the archrivals of the Middle East, are competing in a surprising new category: gender equality.

They appear to be vying over who can be quicker to overhaul their repressive rules for women.

Tehran’s police chief announced this week that the so-called morality police who patrol the capital would no longer automatically detain and punish women seen without the proper hijab head-covering in public, an offense commonly called “bad hijab.” They will be given counseling instead.

In Saudi Arabia, one of the most restrictive countries for women, the authorities this week allowed female contestants at an international chess tournament to play without the full-body garb known as an abaya. That decision is the latest in a string of liberalizing moves by Crown Prince Mohammed bin Salman, the young Saudi ruler, which includes letting women drive.