In observance of Ramadan, the ninth month of the Islamic lunar calendar, healthy adult Muslims abstain from all food or drink—including water and oral medications during daylight hours. Essentially, believers break their fast and only eat meals before sunrise and again after sunset. But eating right and staying healthy during a fast can be tricky, especially in the summer heat. Still, you can fast safely during Ramadan, according to a recent article published by the Grio. Here’s how.

First, it’s important to know who shouldn’t be fasting (during  Ramadan and otherwise): children who have not hit puberty yet, anyone who is sick or needs medication throughout the day, and women who are pregnant, nursing or menstruating. In addition, travelers and the elderly are also exempt from fasting.

For those OK’d to fast during Ramadan, the special 30-day period of prayer, reflection and self-sacrifice can provide a great opportunity to eat healthier foods, change bad eating habits, lose weight and quit smoking. The traditional fast is also said to impart spiritual wisdom.

A pre-dawn meal, known as suhur and then a sunset meal, called iftar, should include healthy proteins and hydrating vegetables to help fuel your body throughout the day. (Think an omelet with lots of colorful veggies on the plate.)

It’s also important to note that almost all Muslims around the world break their fast by eating dates and drinking water or milk. Nutrients in dates replace important electrolytes and vitamins the body loses from perspiration, and fluids provide the body with much-needed hydration.

Nutritionists also suggest that people who fast avoid sugary drinks when they resume eating—water should be their primary source of hydration. What’s more, take care not to eat too quickly or too much after a fast. (After the first few days of fasting, the metabolism starts slowing down, so once you start eating again it’s easy to gain weight.) This means limit your delicious post-Ramadan desserts to just one a day.

Many people also fast throughout the year to cleanse the body, increase energy and lose fat. Click here for more information about healthy cleanses and how to talk to your doctor about undergoing a diet detox.