SAN SALVADOR — When in human history has an epidemic become so alarming that a nation feels compelled to urge its people not to have children for two years?

Grappling with a mosquito-borne virus linked to brain damage in infants, El Salvador is doing just that, advising all women in the country not to get pregnant until 2018 — the equivalent of a Hail Mary pass that, to many here, only illustrates their government’s desperation.

“It’s not up to the government; it’s up to God,” said Vanessa Iraheta, 30, who is seven months pregnant with her second child. “I don’t think the youth will stop having children.”

The virus, known as Zika, has rattled Latin America and the Caribbean, particularly Brazil, where more than a million people have been infected and nearly 4,000 children have been born with microcephaly, a rare condition in which babies have unusually small heads.