Almost no one works in an Egyptian clothing factory because she wants to. The teen-age girls are saving for their dowries, and they will quit when they have enough money. Some of the older women are divorced and have children to support. The married ones usually need money badly enough that their husbands have reluctantly allowed them to work. Rania didn’t quite fit into any of those groups. She was married but living apart from her husband when, eight years ago, she started working at the Delta Textile Factory in the city of Minya, a hundred and sixty miles south of Cairo. As long as they were separated, her husband, Yasser, wouldn’t find out. Unhappiness creates its own freedom, although Rania didn’t know that yet. She was twenty-two years old, with acne-scarred red cheeks, full lips, and a black wool hijab that wrapped her face in a small circle and made her appear younger than she was.

On Rania’s second day in the factory, a Romanian-American manager named Elena asked, “Who wants to work in quality control?” Rania had little idea what quality control was, but she boldly raised her hand. Elena was the first foreigner she had ever met. She trained Rania to spot every potential problem in a pair of men’s underpants. If a leg was millimetres too short, or the seams around the crotch didn’t lie flat, a client could reject the order and cost the factory thousands of dollars. Rania developed a preternatural ability to keep the line moving while catching mistakes almost as soon as they happened. Two years after she entered the factory, she was promoted to supervisor, but she never forgot what it felt like to be a newcomer.

Rania’s capacity for work was legendary—bi-mit ragel, as the Egyptians say, “worth a hundred men.” Every month, the factory awarded prizes to its most productive workers; the line she supervised placed first more times than she could count, and the dinnerware sets and kettles she won cluttered her cabinet at home, useless in their abundance. She had a way of attracting notice and charging into conversations. Executives or clients visiting the plant always asked who she was. In her red supervisor’s tunic, silver flip-flops, and wide-legged black trousers (she was often the only woman in the factory wearing pants), Rania moved around the production floor as if she were at home, and in a way she was.

In the summer of 2016, the company’s executives called a meeting of the factory employees and announced that they planned to hire their first local production manager, who would oversee a bloc of ten assembly lines. Such positions had always been held by an expatriate man, but everyone in the meeting immediately turned to look at Rania. Before the meeting, in fact, Ian Ross, the company’s C.E.O. in Egypt, had told Rania that she was being considered for the job. He warned her not to make problems with the other supervisors, with whom she sometimes fought.

“I don’t make any problems,” Rania answered coolly, but inside she felt excited and proud. She was determined to show everyone that she could be the first female production manager in Upper Egypt.

Egypt has made some progress toward gender equality in recent years. Girls and boys now attend school in equal numbers, and Egyptian universities turn out more female than male graduates. Women are marrying later and having fewer children than they did two decades ago. But these gains have not propelled women into the workforce. For every Egyptian woman who works, almost four stay home. The percentage of women in the labor force has remained flat for two decades; among some groups, such as those with college degrees, it has actually fallen. A 2004 World Bank study estimated that, if women in the Middle East worked at the same rates as their peers in other parts of the world, average household income would rise by as much as twenty-five per cent, enough to push many families out of poverty. The Bank also estimated, however, that at the current rate of increase in female employment it would take the region a hundred and fifty years to catch up to the rest of the world.

Resistance to female employment in many parts of the Middle East is grounded in ideas of male dignity. When a woman works, it is often taken as a sign that her husband has failed to take care of her. One of the best-known verses of the Quran says, “Men are the protectors and maintainers of women, because Allah has given the one more than the other, and because they support them from their means.” Marriage entails clear and complementary responsibilities: a man supports his wife, and she, in turn, obeys him. Wifely submission is even written into the Egyptian legal code. A woman who leaves the house or gets a job without her husband’s permission is considered nashiz—rebellious—and forfeits her right to his financial support.

Other obstacles stand in the way of women who want to work. Many women are reluctant to travel far from home on public transportation, out of fear of sexual harassment; they don’t want to spend their days in small workplaces or shops where they will be in close contact with male co-workers or strangers; they prefer to leave work early, to be home in time to cook dinner for their husbands. “It’s not about the wage. It’s really about the working conditions,” Ragui Assaad, an economist at the University of Minnesota who studies labor and development, told me. “If the working conditions are met, women are ready to work in droves. But, if they are not met, very few are willing to work.”

In the nineteen-sixties and seventies, when Nasser-era policies guaranteed employment to all college graduates, women joined the workforce by the millions. But the public sector, which still employs more than half of all working women—as administrators, clerks, nurses, and teachers—has been shrinking for two decades. Private-sector jobs, which often require long hours and offer few benefits, aren’t as appealing to women. China and India have built dynamic manufacturing sectors that are dominated by female workers, but Egypt’s high-growth industries, which include oil, tourism, construction, and transportation, are mainly the province of men.

Almost every woman I met inside the Delta Textile Factory had to persuade a father or a husband to let her work there. If a woman is tired or has a bad day, there’s often someone at home to talk her into quitting. What can a woman do when it’s not the law or the government that stands in her way but the people who love her most?

When Rania was a girl, she thought that she might be a police officer or a doctor one day. Instead, she got married while still in her teens, as did almost all the young women in her village. Her parents divorced when she was a baby, and her father had gone to work in Iraq. Divorce is common in Muslim societies—according to some scholars, it was ubiquitous even in pre-modern times—but laws and local customs regarding divorce tend to favor men and punish women. When Rania was twelve, her mother remarried, and Rania had to leave home because, by law, divorced women lose custody of their children if they marry again. Rania shuttled between the homes of several uncles; during her middle-school years, they didn’t allow her to attend school and made her work in their construction-materials warehouse. “They wanted to crush me,” Rania said.