diff --git a/src/Makefile.am b/src/Makefile.am
index fa6b659891685097c8750bc72e373325c549c948..22d8a2362a52240ecb14f61964ee45dc921be875 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,6 +39,7 @@ AM_CPPFLAGS = \
 	$(DUNE_CPPFLAGS) \
 	$(PYTHON_CPPFLAGS) \
 	$(ALUGRID_CPPFLAGS) \
+	$(UG_CPPFLAGS) \
 	-I$(top_srcdir)
 
 # The libraries have to be given in reverse order (most basic libraries
@@ -46,10 +47,12 @@ AM_CPPFLAGS = \
 LDADD = \
 	$(DUNE_LDFLAGS) $(DUNE_LIBS) \
 	$(ALUGRID_LIBS) \
+	$(UG_LIBS) \
 	$(PYTHON_LIBS)
 AM_LDFLAGS = \
 	$(DUNE_LDFLAGS) \
 	$(ALUGRID_LDFLAGS) \
+	$(UG_LDFLAGS) \
 	$(PYTHON_LDFLAGS)
 
 if CAIROMM
diff --git a/src/gridselector.hh b/src/gridselector.hh
index 0940e87a2b4af9f71ebc2d6d72eee75fcb569cfc..0e27a54fbcaf2ca7cfcfb6ecbb7d28eca5c9609f 100644
--- a/src/gridselector.hh
+++ b/src/gridselector.hh
@@ -3,6 +3,7 @@
 #endif
 
 #define WANT_ALUGRID 0
+#define WANT_UG 1
 
 #define WANT_GRID WANT_ALUGRID
 
@@ -17,6 +18,14 @@
 #pragma clang diagnostic pop
 using Grid = Dune::ALUGrid<MY_DIM, MY_DIM, Dune::simplex, Dune::nonconforming>;
 
+#elif WANT_GRID == WANT_UG
+
+#if !HAVE_UG
+#error UG was requested but not found
+#endif
+#include <dune/grid/uggrid.hh>
+using Grid = Dune::UGGrid<MY_DIM>;
+
 #else
 
 #error requested a grid that does not exist