ISTANBUL — Not long after a security crackdown smothered the antigovernment protests that convulsed Turkey for weeks, thousands of people took to the streets of Istanbul again on Sunday, this time for a march to demand better treatment and equal rights for lesbian, gay, bisexual and transgender people.

When the first gay rights parade was organized here in 2003, only a few dozen people dared to take part. But on Sunday, at least 20,000 people joined the march, many of them holding rainbow flags and chanting slogans denouncing government policies that discriminate based on sexual orientation. And although memories of the police crackdown on protesters were still fresh, Sunday’s event was peaceful.

Demonstrations initially focused on saving Istanbul’s central Gezi Park from destruction grew in response to Prime Minister Recep Tayyip Erdogan’s autocratic and dismissive reaction toward the protests, a criticism that echoes the longstanding complaints of lesbians, gay men and bisexual and transgender people in Turkey.