In this paper, we study the expected discounted penalty functions and their decompositions in a Markov-modulated risk process in which the rate for the Poisson claim arrivals and the distribution of the claim amounts vary in time depending on the state of an underlying (external) Markov jump process. The main feature of the model is the flexibility modeling the arrival process in the sense that periods with very frequent arrivals and periods with very few arrivals may alternate. Explicit formulas for the expected discounted penalty function at ruin, given the initial surplus, and the initial and terminal environment states, are obtained when the initial surplus is zero or when all the claim amount distributions are from the rational family. We also investigate the distributions of the maximum surplus before ruin and the maximum severity of ruin. The dividends-penalty identity is derived when the model is modified by applying a barrier dividend strategy.