Medical image segmentation is crucial for extracting diagnostic information from complex images. Traditional U-shaped convolutional neural networks (CNNs) and their variants have shown promising results but struggle with cross-dimensional interaction and spatial information loss. To address these issues, this paper introduces a novel medical image segmentation model, global attention context encoder network (GAC-Net). GAC-Net integrates a context encoding block (CEB) into the encoder to capture multi-scale semantic information and a global attention block (GAB) into the skip connections to enhance long-range semantic interaction and mitigate semantic loss. Experimental results on five public medical image datasets demonstrate that GAC-Net achieves state-of-the-art performance, with improvements in metrics such as mean intersection over union (MIoU), Hausdorff distance (HD), and dice similarity coefficient (DSC). For example, in cell contour segmentation, GAC-Net achieved an MIoU of 90%, an HD of 10.26 mm, a DSC of 94%, and an ASD of 9.51 mm. The proposed model effectively improves segmentation accuracy, providing new insights into medical image segmentation research. The code for this paper has been released at https://github.com/wu501-CPU/GAC-Net.