Across the street from the official residence of Pakistan's military chief, the heady smell of fermenting hops and barley wafts from a Victorian-era brewhouse that has been producing fine ale since the days of the raj.

The Murree Brewery, established in 1861 to slake the thirst of British soldiers across the Indian subcontinent, lost much of its market when Pakistan won independence nearly 60 years ago, but it still prospers as the Islamic country's only licensed beer maker.

Despite a law that bars Muslims -- about 97 percent of Pakistan's 150 million people -- from drinking alcohol, business is brisk.

The brewery ostensibly caters only to the country's small communities of Christians, Hindus, Sikhs, Parsees and foreigners. In reality, much of its output supplies a black market for illicit drinkers.

"Officially, Muslims may only imbibe alcohol on pain of punishment, but unofficially, it's easy for Muslims to acquire it," said Minoo Bhandara, the brewery's chief executive.

Non-Muslims make up 3 percent of the population and probably account for about the same proportion of the consumption of alcohol, he estimated.

The brewery, modernized in the 1990s with German technology, can produce about 8,000 bottles of beer an hour. It also makes a wide range of soft drinks and spirits, including critically acclaimed single malt whiskeys.

Later this year, Murree plans to unveil its finest vintage yet: an 18-year-old single malt whiskey. Maturing in oak vats in the brewery's vaults, it promises to be a tipple as rich in taste as the Murree enterprise is in irony.

Two Britons, Edward Dyer and Edward Whymper, founded the brewery at the Himalayan hill station of Murree, not far from Rawalpindi, a few years after Britain formally colonized India in 1857. It was one of the first modern breweries in Asia. The Murree beer bottle label still proudly recounts its medal for excellence at the Philadelphia Exhibition in 1876.

Its beer became popular in army messes across British India, and as the company's Web site delicately puts it: "The virtues of beer brewed from barley malt and hops as a light alcoholic beverage were not lost on the local population who became avid consumers."

The brewery's heyday was during World War II, when it produced 1.6 million gallons of beer a year. The boom ended when Pakistan achieved independence from Britain in 1947.

The new Islamic state barred Muslims from drinking.

Prohibition, however, was "rather tepid," Bhandara said. Many got around the ban by obtaining doctor's certificates saying they needed alcohol for a medical condition.

The rules were toughened in 1977 by President Zulfiqar Ali Bhutto in a move to appease Islamic hard-liners, shortly before he was overthrown in a military coup and executed. The law carries punishments of three years in prison and 20 lashes for Muslims caught drinking alcohol in public.

Only non-Muslims can acquire a permit that allows them to buy alcohol for consumption at home on religious holidays. Drinkers are supposed to return anything left over within a week, but no one does.

There are about 120 licensed alcohol sellers across Pakistan -- usually small places at the back of fashionable hotels, crowded by sheepish customers who slink away with bottles of liquor concealed in black plastic bags.

Much of what is bought legally is sold to Muslims at a premium. There is also a big market for booze smuggled into Pakistan, mostly from India and duty-free Afghanistan.

Bhandara, whose father bought into the brewery at independence, said that if the government allowed liquor to be openly available and not heavily taxed, he could triple or quadruple production -- back to its wartime peak.

But with the religious lobby strong, the brewery is looking to expand elsewhere. Currently, it is trying to break into the British market, with the catchphrase: "Have a Curry With Your Murree." Many pubgoers in England round off a night out with a meal at an Indian restaurant, washed down with a pint.

Exporting alcohol from Pakistan is prohibited, however, so Murree has licensed a brewery in Austria to make the beer.

Most of Murree's 400 workers are Muslims, among them the quality control chief Huma Zubair, a chemist and microbiologist who learned brewing in the United States in the 1990s.

But she isn't a fan of beer. She always spits it out after a taste test.

"But I really enjoy the job," Zubair said. "It's very relevant to my studies."