The nonuniformity inherently generated in infrared focal plane arrays (IRFPA) due to the inconsistent offsets of detectors severely degrades the performance of infrared imaging systems. This paper proposes a novel spatial and temporal adaptive nonuniformity correction (NUC) algorithm for the IRFPA, based on a statistical model of the infrared images. After subtracting the local means of an infrared image, the residuals are modeled as a collection of generalized Gaussian random variables with inhomogeneous means. Based on this model, a Maximum Likelihood estimation of the offsets is formally derived, producing an online adaptive temporal filter. The filtering result can be further refined by fusing it with the result of a spatial filter. Therefore, we derive an adaptive Wiener filter to remove the non-uniformity in a single frame and provide an adaptive fusion scheme based on the Minimum Mean Square Error criterion. The overall computational complexity of the proposed NUC algorithm is around O(m n logm n) for an infrared image with the size of m × n, which preserves the potential of the algorithm to be implemented on the board within a thermal camera. Extensive experiments on synthesized and real data have demonstrated the superior performance of the proposed algorithm.