diff --git a/doc/dynare.texi b/doc/dynare.texi
index 23ddc0de247153dd1dcd7f62263343de37d294ad..ce6e3ab0a9903f289a895f4be6b7816675ddc15b 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -6020,6 +6020,15 @@ the option is equal to @code{0}, Dynare will not automatically change
 the filter, but rather use a penalty value for the likelihood when
 such a singularity is encountered. Default: @code{1}.
 
+@item keep_kalman_algo_if_singularity_is_detected
+@anchor{keep_kalman_algo_if_singularity_is_detected}
+With the default @ref{use_univariate_filters_if_singularity_is_detected}=1, Dynare will switch 
+to the univariate Kalman filter when it encounters a singular forecast error variance
+matrix during Kalman filtering. Upon encountering such a singularity for the first time, all subsequent
+parameter draws and computations will automatically rely on univariate filter, i.e. Dynare will never try 
+the multivariate filter again. Use the @code{keep_kalman_algo_if_singularity_is_detected} option to have the 
+@code{use_univariate_filters_if_singularity_is_detected} only affect the behavior for the current draw/computation.
+
 @item qz_zero_threshold = @var{DOUBLE}
 @xref{qz_zero_threshold}.
 
diff --git a/matlab/dsge_likelihood.m b/matlab/dsge_likelihood.m
index 2d3406ed560e59e0aa175a0f5a83afc083dbb254..3da705c9aefc2f48d8837c02135424d79ecc5df1 100644
--- a/matlab/dsge_likelihood.m
+++ b/matlab/dsge_likelihood.m
@@ -894,8 +894,10 @@ if imag(fval)~=0
     return
 end
 
-% Update DynareOptions.kalman_algo.
-DynareOptions.kalman_algo = kalman_algo;
+if ~DynareOptions.kalman.keep_kalman_algo_if_singularity_is_detected
+    % Update DynareOptions.kalman_algo.
+    DynareOptions.kalman_algo = kalman_algo;
+end
 
 if analytic_derivation==0 && nargout>3,
     lik=lik(start:end,:);