Comcrop’s 600-square-meter (6,450-square-foot) farm on the roof of one of the malls uses vertical racks and hydroponics to grow leafy greens and herbs such as basil and peppermint that it sells to nearby bars, restaurants and stores.

The farm’s small size belies its big ambition: to help improve the city’s food security.

Comcrop’s Allan Lim, who set up the rooftop farm five years ago, recently opened a 4,000-square-meter farm with a greenhouse on the edge of the city.

He believes high-tech urban farms are the way ahead for the city, where more land cannot be cultivated.

“Agriculture is not seen as a key sector in Singapore. But we import most of our food, so we are very vulnerable to sudden disruptions in supply,” Lim said.

“Land, natural resources and low-cost labor used to be the predominant way that countries achieved food security. But we can use technology to solve any deficiencies,” he said.

Singapore last year topped the Economist Intelligence Unit’s Global Food Security Index of 113 countries for the first time, scoring high on measures such as affordability, availability and safety.

Yet, as the country imports more than 90 percent of its food, its food security is susceptible to climate change and natural resource risks, the EIU noted.

With some 5.6 million people in an area three-fifths the size of New York City — and with the population estimated to grow to 6.9 million by 2030 — land is at a premium in Singapore.

The country has long reclaimed land from the sea, and plans to move more of its transport, utilities and storage underground to free up space for housing, offices and greenery.

It has also cleared dozens of cemeteries for homes and highways.

Agriculture makes up only about 1 percent of its land area, so better use of space is key, said Samina Raja, a professor of urban and regional planning at the University at Buffalo in New York.

“Urban agriculture is increasingly being recognized as a legitimate land use in cities,” she said.

“It offers a multitude of benefits, from increased food security and improved nutrition to greening of spaces. But food is seldom a part of urban planning.”

Countries across the world are battling the worsening impacts of climate change, water scarcity and population growth to find better ways to feed their people.

Scientists are working on innovations from gene editing of crops and lab-grown meat, to robots and drones to fundamentally change how food is grown, distributed and eaten.

With more than two-thirds of the world’s population forecast to live in cities by 2050, urban agriculture is critical, a study published last year stated.

Urban agriculture currently produces as much as 180 million metric tons of food a year — up to 10 percent of the global output of legumes and vegetables, the study noted.

Additional benefits, such as reduction of the urban heat-island effect, avoided stormwater runoff, nitrogen fixation and energy savings could be worth $160 billion annually, it said.

Countries including China, India, Brazil and Indonesia could benefit significantly from urban agriculture, it said.

“Urban agriculture should not be expected to eliminate food insecurity, but that should not be the only metric,” said study co-author Matei Georgescu, a professor of urban planning at Arizona State University.

“It can build social cohesion among residents, improve economic prospects for growers, and have nutritional benefits. In addition, greening cities can help to transition away from traditional concrete jungles,” he said.

Singapore was once an agrarian economy that produced nearly all its own food: there were pig farms and durian orchards, and vegetable gardens and chickens in the kampongs, or villages.

But in its push for rapid economic growth after independence in 1965, industrialization took precedence, and most farms were phased out, said Kenny Eng, president of the Kranji Countryside Association, which represents local farmers.

The global food crisis of 2007-08, when prices spiked, causing widespread economic instability and social unrest, may have led the government to rethink its food security strategy to guard against such shocks, Eng said.

“In an age of climate uncertainty and rapid urbanization, there are merits to protecting indigenous agriculture and farmers’ livelihoods,” he said.

Local production is a core component of the food security road map, according to the Agri-Food and Veterinary Authority (AVA) of Singapore, a state agency that helps farmers upgrade with technical know-how, research and overseas study tours.

Given its land constraints, AVA has also been looking to unlock more spaces, including unfertilized or alternative spaces, and harness technological innovations to “grow more with less,” a spokeswoman said by email.

A visit to the Kranji countryside, just a 45-minute drive from the city’s bustling downtown, and where dozens of farms are located, offers a view of the old and the new.